1.0.3 • Published 5 years ago

use-tabbable-list v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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