Navigation
PanelHeaderContext
Drop-down sheet that slides out under the PanelHeader, e.g. to switch modes or filters.
import { PanelHeaderContext } from "datui";Examples
Mode switcher
Place it right after the PanelHeader. Point the trigger's aria-controls at the sheet's id.
Showing: All news
Accessibility
- Renders
role="dialog"named bylabel(default "Options"). Focus moves into the sheet when it opens and back to the previously focused element when it closes. - Escape and a press outside the sheet call
onClose; pressing the trigger (matched byaria-controls) is not treated as outside, so it can toggle. - Set
aria-expandedon the trigger yourself —PanelHeaderContentpasses it through. - Body scroll is locked on compact widths while open. Opening and closing animate unless reduced motion is on.
API
PanelHeaderContext
Drop-down sheet under the `PanelHeader`. Place it right after the header. Give the trigger `aria-controls={id}` so pressing it toggles instead of counting as an outside press.
| Prop | Type | Default | Description |
|---|---|---|---|
| onClose (required) | () => void | — | Called on Escape and on a press outside the sheet and its trigger. |
| opened (required) | boolean | — | |
| className | string | — | |
| label | string | Options | Accessible name of the sheet. |