Bedform UIGuides

State and Accessibility

Component state and accessibility.

Default state

Native elements keep their own state. Use the uncontrolled props, such as open on an accordion or defaultChecked on a checkbox, to set where they start.

<Accordion open>
  <summary>Details</summary>
  <div className="ore-accordion-content">World settings</div>
</Accordion>

Controlled state

When the application controls the state, pass it as a prop and update it from the component's event:

const [open, setOpen] = useState(true);

<Accordion
  open={open}
  onToggle={(event) => setOpen(event.currentTarget.open)}
>
  <summary>Details</summary>
  <div className="ore-accordion-content">World settings</div>
</Accordion>;

Accessibility checklist

  • Add aria-label to icon-only controls.
  • Use native headings, tables, links, and form labels.
  • Keep focus styles visible.
  • Avoid overriding keyboard handling or ARIA state managed by native controls.
  • Place errors and help text in the component's documented public parts, or the description and error props of text fields.

On this page