0.1.6 • Published 2 months ago

@ciceksepeti/cui-focus-trap v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@ciceksepeti/cui-focus-trap

npm version storybook PRs Welcome license

Component that traps focus within a DOM node A focus trap ensures that tab and shift + tab keys will cycle through the focus trap's tabbable elements but not leave the focus trap. This is great for making accessible modals.

Installing

Using Npm:

$ npm install @ciceksepeti/cui-focus-trap

Using Yarn:

$ yarn add @ciceksepeti/cui-focus-trap

Example

import FocusTrap from "@ciceksepeti/cui-focus-trap";

function Demo() {
  return (
    <FocusTrap>
      <div>
        <button>focusable</button>
        <button>focusable</button>
        <button>focusable</button>
        <button disabled>disabled</button>
        <button style={{ visibility: "hidden" }}>hidden</button>
        <button tabIndex={-1}>tabindex -1</button>
        <button>focusable</button>
      </div>
    </FocusTrap>
  );
}
0.1.6

2 months ago

0.1.5

3 months ago

0.1.4

3 months ago

0.1.2

4 months ago

0.1.3

4 months ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago