Getting Started
Components
- Advanced Toast
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- ChatButton
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- Date Field
- Dropdown
- ElasticHeight
- ExpandableCard
- Filter
- FormCheckbox
- Form Control
- Form Label
- HamburgerIcon
- Heading
- Image
- Link
- Loader
- Number Field
- Pagination
- Password
- Phone Field
- Popin
- Portal
- Prose
- Radio Group
- Radio
- Range
- Select
- SidebarLayout
- Spinner
- Switch
- Tabs
- Tag
- TextField
- ValidationMessage
'use client';
import { Avatar } from '@/ui/Avatar';
import { Dropdown } from '@/ui/Dropdown';
import { Button } from '@/ui/buttons/Button';
export function DropdownDemo() {
const user = { firstName: 'John', lastName: 'Doe' };
return (
<Dropdown aria-label="Open user actions">
<span data-slot="label" className="hidden md:inline text-body">
{user.firstName} {user.lastName}
</span>
<Avatar
data-slot="label"
alt={`${user.firstName} ${user.lastName}`}
className="w-40 h-40 cursor-pointer hover:opacity-80 transition-opacity"
style={{ width: '40px', height: '40px' }}
/>
<Button>Logout</Button>
</Dropdown>
);
}
Usage
import { Dropdown } from '@/ui/Dropdown';
import { Avatar } from '@/ui/Avatar';
import { Button } from '@/ui/buttons/Button';
export function Component() {
const user = { firstName: 'John', lastName: 'Doe' };
return (
<Dropdown aria-label="Open user actions">
<span data-slot="label" className="hidden md:inline text-body">
{user.firstName} {user.lastName}
</span>
<Avatar
data-slot="label"
alt={`${user.firstName} ${user.lastName}`}
className="w-40 h-40 cursor-pointer hover:opacity-80 transition-opacity"
style={{ width: '40px', height: '40px' }}
/>
<Button>Logout</Button>
</Dropdown>
);
}API Reference
Dropdown Props
| Prop | Type | Default | Description |
|---|---|---|---|
icon | IconicNames | ArrowOutlinedDown | Icon shown on the trigger button |
className | string | undefined | Additional classes for the root dropdown container |
children | ReactNode | undefined | Slot content (label) and overlay content |
...props | button props | - | Standard button attributes passed to the trigger button |
Slots
The component is composable through slots using data-slot.
| Slot | Description |
|---|---|
data-slot="label" | Trigger content. You can provide one or multiple elements (text, avatar...). |
Children without data-slot="label" are rendered inside the dropdown overlay panel.
Behavior
- Clicking the trigger toggles the overlay.
- Clicking outside closes the overlay.
- The overlay stays mounted and uses animation classes for transitions:
- open:
animate-zoomIn - closing:
animate-zoomOut - hidden state:
opacity-0 scale-90 pointer-events-none
- open:
Accessibility
- Provide an explicit
aria-labelonDropdownfor the trigger. - Ensure overlay actions are keyboard reachable (buttons/links).
- Keep slot label content meaningful for assistive technologies.