Accordion: Custom icon
Pass any element to icon. Style its open state with group-data-panel-open/accordion-trigger.
A collection of components built on top of shadcn/ui, with careful attention to structure and micro-interactions.
Copy the source into your project, then edit it like any other file you own.
Yes. Every component is free and open source, for personal and commercial work.
This adds the example as components/examples/accordion/custom-icon.tsx, together with the Accordion component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/accordion-custom-icon.jsonTo add only the component, follow the Accordion installation.
Props in this example
The Accordion props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "outline" | "separated" | "ghost" | "default" |
| Prop | Type | Default |
|---|---|---|
valueGenerated automatically when omitted. | Value | – |
| Prop | Type | Default |
|---|---|---|
iconnull removes the icon. | ReactNode | null | <IconChevronDown /> |
Every prop is in the Accordion API reference.
See them all, with keyboard support and accessibility notes, on the Accordion page.
- Aspect ratioA box that holds its shape before media loads, shimmers while loading, fades the media in and falls back when it fails.
- CarouselNative scroll-snap slides with momentum on touch, mouse dragging, arrow keys, dots, thumbnails and an autoplay that pauses when it should.
- CollapsibleA panel that shows and hides with height motion you can reverse mid-way, without jumping the layout.
- ResizablePanels you can drag apart, with a quiet divider that wakes up on hover, sizes that glide on reset or collapse, and layouts that persist.
- Scroll areaNative scrolling with a minimal scrollbar, edges that fade only where there’s more to see, and an optional peek that cuts the last item in half.
- SeparatorA hairline that divides content horizontally or vertically, with an optional label and a decorative mode for purely visual lines.