prop getter
A function returned by a headless hook, such as getTriggerProps(), that gives back the attributes and event handlers an element needs.
In more detail
The consumer spreads the result onto their own element: <button {...getTriggerProps()}>. This wires up ARIA attributes and keyboard handlers declaratively while leaving the markup and styling free. It is an alternative to sharing state through compound components and context.
Example
getTriggerProps() returns { type: "button", "aria-expanded": open, "aria-controls": "panel-1" }.Related terms
- headless component — A component that provides behaviour, state and accessibility but no styling, leaving the look entirely to the consumer.
- compound component — A set of components designed to be used together, such as Tabs, Tabs.Trigger and Tabs.Panel, that share state behind the scenes.
- ARIA — The W3C standard of HTML attributes, such as role and aria-expanded, that tell assistive technology what a custom widget is and what state it is in.
Taught in
- Headless Architecture: State vs Presentation Separation — Design Systems & Component Engineering