Backpack UI
Components
FocusRing

FocusRing

FocusRing is a simple wrapper around the @react-aria/focus's FocusRing component, with added styles for focus indication. It can be used to wrap any interactive element that needs a custom focus indicator.

Importing


_10
import { FocusRing } from '@ef-global/backpack/FocusRing';

Props

PropertyTypeRequiredDescription
childrenReact.ReactElementYesA single React element that will be wrapped with the custom focus ring indicator.
classNamestringNoOptional additional CSS class to be applied to the focus ring.

Usage

To use the FocusRing component, simply import it and wrap the element that requires the custom focus indicator. Here's an example:


_10
_10
function MyComponent() {
_10
return (
_10
<FocusRing>
_10
<Button>Click me!</Button>
_10
</FocusRing>
_10
);
_10
}

In the example above, a Button component is wrapped with the FocusRing to provide a custom focus indicator when the button is focused.