useId is a Atomico Hook for generating unique IDs that can be passed to accessibility attributes.


import { useId } from "atomico";

const stringId = useId();


Use ID generate a unique ID for each component, this id can be useful for referencing CSS selectors or creating names for inputs that only the component knows about.

function component() {
  const id = useId();
  return <host id={id}>
    <style>{`#${id}{ display: block; color: white; }`}</style>

Last updated