2.7.2 • Published 2 years ago
react-focus-trap v2.7.2
A generic focus management tool for components such as dialogs and dropdowns.
Usage
React Focus Trap is a container element that will manage focus for its children.
let Modal = React.createClass({
render() {
return (
<FocusTrap onExit={ this._onExit } active={ this.props.active }>
Amazing stuff goes here
</FocusTrap>
)
}
})
When Focus Trap is active, it will do several things:
- Ensure focus remains on its content
- Exits when clicks outside of the container occur
- Exits when the escape key is pressed
Props
Name | Default | Description |
---|---|---|
active | true | Should the FocusTrap render? |
className | 'focus-trap' | The class of the inner container that maintains focus |
onExit | null | Callback when escape or an outside click occurs |
element | 'div' | The tag name of the inner container |
role | 'dialog' | The aria role for the inner container |
Visit code.viget.com to see more projects from Viget.
2.7.2
2 years ago
2.7.1
6 years ago
2.7.0
6 years ago
2.6.0
6 years ago
2.6.0-beta.0
6 years ago
2.5.0
7 years ago
2.4.0
7 years ago
2.3.3
8 years ago
2.3.2
8 years ago
2.3.1
8 years ago
2.3.0
8 years ago
2.2.0
8 years ago
2.1.0
8 years ago
1.1.2
8 years ago
2.0.0
8 years ago
1.1.1
8 years ago
1.2.0
9 years ago
1.1.0
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.8.0
9 years ago
0.7.0
9 years ago
0.7.0-alpha
9 years ago
0.6.1
9 years ago
0.6.0
9 years ago
0.5.2
9 years ago
0.5.1
9 years ago
0.5.0
9 years ago
0.4.0
9 years ago
0.3.0
9 years ago
0.2.0
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago
0.0.1
9 years ago