Getting Started
Components
- Accordion
- Advanced Toast
- AlertMessage
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- Carousel
- Chapters
- ChatBody
- ChatButton
- ChatHeader
- ChatInput
- ChatMessageActions
- ChatMessageEditor
- ChatMessage
- ChatTypingIndicator
- ChatWindowCsatPrompt
- ChatWindowQuote
- ChatWindow
- CheckboxSelect
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- ContentReview
- Countdown
- CriteriaDates
- CriteriaParticipants
- CriteriaTransports
- Date Field
- Datepicker
- Dropdown
- ElasticHeight
- ExpandableCard
- ExpandableText
- Filter
- FloatingLabelTextField
- Form Control
- Form Label
- Frame
- HamburgerIcon
- Heading
- Image
- JourneyCard
- LayerHeader
- Layer
- Link
- Loader
- Number Field
- PageNavigation
- Pagination
- Paragraph
- Password
- Phone Field
- Popin
- Portal
- ProductThumbnail
- Promises
- Prose
- Radio Group
- RadioSelect
- Radio
- Range
- Scrollbar
- Select
- SidebarLayout
- SliderFrame
- SparkleWrapper
- Spinner
- Switch
- Table
- Tabs
- Tag
- TextField
- Toggle
- Tooltip
- ValidationMessage
Search filters
'use client';
import { LayerHeader } from '@/ui/LayerHeader';
export function LayerHeaderDemo() {
return (
<div className="border-lightGrey w-full border">
<LayerHeader
hLevel={2}
leftButton={{ label: 'Back', icon: 'ArrowDefaultLeft', onClick: () => {} }}
rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: () => {} }}
>
Search filters
</LayerHeader>
</div>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/layer-header.json
Usage
<Layer /> renders its own LayerHeader. Use it directly to build a layer-like panel, like a sidebar or a bottom sheet.
import { LayerHeader } from '@/ui/LayerHeader';
export function Component() {
return (
<LayerHeader
hLevel={2}
leftButton={{ label: 'Back', icon: 'ArrowDefaultLeft', onClick: goBack }}
rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: close }}
>
Search filters
</LayerHeader>
);
}API Reference
LayerHeader
Extra props are spread on the <header> element.
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | undefined | Content of the heading. |
hLevel | 1 | 2 | 3 | 4 | 5 | 6 | 1 | Level of the heading tag. |
hAriaLevel | number | undefined | Level announced to assistive technologies (aria-level), without changing the tag. |
id | string | undefined | Put on the heading, and used as aria-describedby of the buttons. |
leftButton | LayerHeaderButtonProps | undefined | Round button pinned to the inline start. |
rightButton | LayerHeaderButtonProps | undefined | Round button pinned to the inline end. |
className | string | undefined | Classes merged on the <header>. |
LayerHeaderButtonProps
Any <button> attribute and Button prop is forwarded, except variant and theme.
| Prop | Type | Default | Description |
|---|---|---|---|
icon | IconicNames | (required) | Icon of the round button. |
label | string | (required) | Accessible name of the button (aria-label). |
onClick | MouseEventHandler<HTMLButtonElement> | (required) | Click handler. |
Notes
- Centered heading: the buttons are absolutely positioned and the heading keeps a 56px inline padding, so it stays centered whether there are zero, one or two buttons, and long headings wrap instead of running under them.
- RTL: the buttons use logical positions (
start/end), so they swap sides in right-to-left layouts. - Accessible description: give the header an
idto have a screen reader announce the heading after a button name, like "Close, Search filters".