Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@reach/auto-id

reach2.5mMIT0.18.0TypeScript support: included

Autogenerate IDs to facilitate WAI-ARIA and server rendering.

readme

@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 (
        <React.Fragment>
            <label htmlFor={id}>{props.label}</label>
            <input type={props.type} name={props.name} id={id} />
        </React.Fragment>
    );
}

changelog

@reach/auto-id

0.18.0

BREAKING Changes

  • All default exports have been removed. Replace all default imports with the appropriate documented named export.
  • The output directory structure has changed slightly. Module files are now named reach-<pkg>.mjs instead of reach-<pkg>.esm.js.

Minor Changes

  • We have simplified our build setup to remove a boatload of dependencies. Build output for all packages may look slightly different, though functionally packages that don't have explicit changes marked in the release notes have not changed.

    This may affect you if you use patch-package to modify output code. If you need support for legacy browsers, the new bundle may not transpile the same ECMA features as before. In that case you may want to transpile Reach packages directly.

Patch Changes

  • Fix buggy fallback implementation for React 18 (f50908c6)
  • Updated dependencies:
    • @reach/utils@0.18.0