Alternatives to focus-trap-react
200 apps like focus-trap-react, closest match first.
Top picks
- R

react-aria-modal
Launchreact-aria-modal is a React modal component built to follow the WAI-ARIA Authoring Practices. It provides a minimally styled container that wraps your own presentational component, so you control the content and the look. Out of the box, it
- R

react-modal
Launchreact-modal is an accessible modal dialog component for React, maintained in the reactjs organization on GitHub. It renders a dialog above the page so you can show your own content in a popup. You can install it from npm or yarn. For a Reac
- R

react-hotkeys
LaunchReact HotKeys is a React library for declaring keyboard shortcuts and managing focus areas in a React app. You describe your shortcuts as a key map, attach handlers to them with JSX components or a higher-order component, and the library de
- R

react-keyboard
Launchreact-keyboard is a React wrapper around mousetrap.js that handles keyboard shortcuts in a React application. The README describes it as a declarative library for hotkeys and focus. You define a keyMap, an object whose values are key sequen
- R

@rc-component/portal
Launch@rc-component/portal is a React portal primitive that renders content outside the normal component tree, into a container of your choosing, with careful handling of the container through the component's lifecycle. It is part of the Ant Desi
- R

react-bootstrap-modal
Launchreact-bootstrap-modal is a React port of the Bootstrap modal, partly based on jschr's better Bootstrap modals. It reimplements the Twitter Bootstrap modal component in a way that fits React, and it builds on the original work of the react-b
More like focus-trap-react
About focus-trap-react

focus-trap-react
A React component that traps focus
focus-trap-react is a React component that traps keyboard focus inside one of its children, which is useful for an accessible modal. It is a thin wrapper around the focus-trap library and adds React-specific handling. The trap activates automatically when the component mounts, unless you change that, and it deactivates when the component unmounts. Props can activate, deactivate, pause and unpause the trap. The component expects exactly one child element, which can be an HTML element or another component that contains focusable elements, and it cannot be a Fragment, because it needs a reference to the underlying DOM element. The README requires React 18.0.0 or later. It notes that the library no longer sets propTypes or defaultProps, since React 19 removed them, and it suggests TypeScript or a runtime validation library instead. Support is aimed at desktop browsers in current versions of Chrome, Edge, Firefox, Safari and Opera, and Internet Explorer is no longer supported. It suits React developers building dialogs, drawers and other overlays that must keep keyboard users inside them.
- Price
- Free
- Made by
- davidtheclark
- Category
- UI Libraries
- Website
- github.com/focus-trap/focus-trap-react






























