@react-lit/auto-id
TypeScript icon, indicating that this package has built-in type declarations

0.7.0 • Public • Published

@react-lit/auto-id

Autogenerate IDs to facilitate WAI-ARIA and server rendering. Optionally a user-provided string can be supplied to useId instead of auto-generating one.

Installation

$ npm i @react-lit/auto-id
# or
$ yarn add @react-lit/auto-id

Example

import * as React from 'react';
import { useId } from "@react-lit/auto-id";

// This may be a single form field component.
function Example(props) {
  const id = useId(props.id);
  return (
    <>
      <label htmlFor={id}>{props.label}</label>
      <input type={props.type} name={props.name} id={id} />
    </>
  );
}

Development

(1) Install dependencies

$ npm i
# or
$ yarn

(2) Run initial validation

$ ./Taskfile.sh validate

(3) Run tests in watch-mode to validate functionality.

$ ./Taskfile test -w

This project was set up by @jvdx/core

Readme

Keywords

none

Package Sidebar

Install

npm i @react-lit/auto-id

Weekly Downloads

604

Version

0.7.0

License

MIT

Unpacked Size

4.92 kB

Total Files

7

Last publish

Collaborators

  • joelvoss