Todae

Todae

Description

Supporting text below a control. A sibling, not a Field part. id is required so you can name it in aria-describedby. The component writes nothing onto the control.

On this page

Put aria-describedby on Field.Root. Root copies the string onto the input, ahead of any ids the input part was given.

With Field

Description owns its spacing. margin-block-start is field.label.gap (0.4rem) from the control. margin-block-end is 0. Put it after the control. Do not wrap it in an element of its own.

Inside a Field.Group, the group's gap replaces that margin, so the distance stays field.label.gap. The group also spaces Label from the control.

import { Description, Field, Label } from '@tounsoo/todae';
import { useId, useState } from 'react';

export default function DescriptionSibling() {
  const id = useId();
  const hintId = useId();
  const [value, setValue] = useState('');
  return (
    <Field.Group>
      <Label.Root htmlFor={id}>Work email</Label.Root>
      <Field.Root id={id} aria-describedby={hintId}>
        <Field.TextInput value={value} onChange={(event) => setValue(event.target.value)} />
      </Field.Root>
      <Description.Root id={hintId}>We only use this for billing receipts.</Description.Root>
    </Field.Group>
  );
}
We only use this for billing receipts.

This is not Dialog.Description. Dialog Description wires aria-describedby for you. Form Description does not.

Accessible composition

Todae handles: Description.Root renders a <span> with the id you pass, which its type requires, and data-todae-description. It writes nothing onto the control and has no live region. Field.Root passes its aria-describedby to the input, merged with the input's own.

You supply: The link to the control: put the id in aria-describedby on Field.Root, on a Checkbox or Switch, on RadioGroup.Root, or on Fieldset.Root for a group. Keep the text short. It is read as plain text, so a link inside it is not announced as a link when the control is described.

Watch for: A Description that no aria-describedby points at is only visual. Changing its text announces nothing; for news use an ErrorMessage with role="alert" or a live region of your own.

When to use

When: Hint text below a control, as a sibling after it. Needs id; list it in aria-describedby on the control, or on Field.Root inside a Field.

When not: Validation errors → ErrorMessage. Dialog supporting text → Dialog.Description (wires itself). The visible name → Label.

Props

Description.Root props
NameTypeDescription
id Requiredstring

Id the author lists in aria-describedby on the control or Field.Root.

childrenReact.ReactNode

Hint text.

classNamestring

Optional class on the span.