@reach/auto-id
Autogenerate IDs to facilitate WAI-ARIA and server rendering.
Last updated 5 years ago by mjackson .
MIT · Repository · Bugs · Original npm
$ cnpm install @reach/auto-id 
SYNC missed versions from official npm registry.

@reach/auto-id

Stable release MIT license

Docs | Source

Autogenerate IDs to facilitate WAI-ARIA and server rendering.

A string can be supplied as an argument to be useId in lieu of the auto-generated ID. This is handy for accepting user-provided prop IDs that need to be deterministic.

import { useId } from "@reach/auto-id";

function FormField(props) {
  const id = useId(props.id);
  return (
    <Fragment>
      <label htmlFor={id}>{props.label}</label>
      <input type={props.type} name={props.name} id={id} />
    </Fragment>
  );
}

Current Tags

  • 0.10.3                                ...           latest (5 years ago)
  • 0.4.0-beta.0                                ...           next (6 years ago)

5 Versions

  • 0.17.0                                ...           3 years ago
  • 0.8.6                                ...           5 years ago
  • 0.4.0                                ...           6 years ago
  • 0.4.0-beta.0                                ...           6 years ago
  • 0.10.3                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org