use-tabbable-list

1.0.3 • Public • Published

use-tabbable-list

npm Build Status npm npm bundle size (version) code style: prettier

React hook that returns all tabbable elements within a DOM node

Installation

$ npm install use-tabbable-list

Usage

import useTabbableList from 'use-tabbable-list'

function Example() {
  const ref = useRef(null)

  const tabbableList = useTabbableList(ref)

  return (
    <div ref={ref}>
      <input />
      <button>Click!</button>
    </div>
  )
}

API

useTabbableList(ref)

ref

A reference to a DOM Node.

Return value

An array of all tabbable elements within the ref node.

License

MIT

Package Sidebar

Install

npm i use-tabbable-list

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

5.91 kB

Total Files

5

Last publish

Collaborators

  • neosiae