Navigation & Disclosure
Accordion
Expandable sections with single or multiple open panels, optional non-collapsible single mode, disabled items, and height-based animation (no Radix dependency). Organize content into understandable destinations and reveal detail when it becomes relevant. Keep the active location or expanded state easy to recognize. Import it from @/components/kamod-ui/accordion.
Source · Design reference · API reference · Theming · Styles
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthInstallation
Import Accordion, AccordionItem, AccordionTrigger, and AccordionContent.
pnpm add @kamod-ch/uiCopy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@kamod-ch/ui";Usage
Use type="single" with collapsible for shadcn-style behavior, or type="multiple" with defaultValue as an array.
import { Accordion } from "@kamod-ch/ui";Choose a complete composition from the examples below; required child components and props vary by pattern.
<Accordion type="single" collapsible defaultValue="item-1">
<AccordionItem value="item-1">
<AccordionTrigger>Is it accessible?</AccordionTrigger>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
</Accordion>Component Examples & Variants
Explore Accordion in Different Contexts, from the starting pattern to the compositions below. Begin with Basic, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.
Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.
Basic
Start with One Question at a Time. Here, type="single" allows one expanded item, collapsible lets the reader close it, and defaultValue="item-1" opens the first answer initially. The item values connect each trigger to its panel.
This pattern suits short FAQs where opening a new topic should replace the previous answer; compare Multiple when readers need to cross-reference information.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthMultiple
Let Readers Compare Answers. Set type="multiple" and supply an array to defaultValue, such as ['notifications', 'privacy']. Each value identifies an independently expanded panel, so opening another topic does not replace the current answer.
Give every item a stable value, and keep panel content independent so closing one answer never hides a prerequisite for another.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthDisabled
Explain Unavailable Content Nearby. Apply disabled to the specific AccordionItem whose content is unavailable. The surrounding accordion remains usable; this is an item-level interaction choice rather than a different visual layout for the whole collection.
Keep its label readable and provide the reason outside the closed panel; information needed to unlock it must not depend on activating that same trigger.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthBorders
Use Dividers to Clarify the Reading Order. The root border gives the accordion one shared boundary, while border-b separates neighboring items. Use class utilities for this treatment; the disclosure behavior still comes from the same accordion components.
Keep the trigger padding generous, and check that open content aligns with its label at narrow widths.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthCard
Group Related Questions into a Larger Surface. Place the disclosure list inside CardContent and let CardHeader introduce the overall topic. The Card supplies the outer surface; the accordion still owns which individual answers are expanded.
Avoid duplicating the card border on every item; use the Card Examples to compare header and footer arrangements.
Interactive preview
Preact example Local preview theme · Responsive styles follow the preview widthFull widthProps and Data
Configure Accordion using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.
Props overview.
Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.
Component Props
? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.Accordion
AccordionProps
| Prop / type | Description |
|---|---|
children | Configure
|
collapsible | When `type="single"`, `false` keeps one panel always open (clicking the open trigger does not close it). Default `true` matches common shadcn examples.
|
defaultValue | Configure
|
type | Configure
|
AccordionContent
AccordionContentProps
| Prop / type | Description |
|---|---|
children | Configure
|
class | Configure
|
duration | Grid transition duration, e.g. `400ms`
|
forceMount | Configure
|
id | Configure
|
largeContentThreshold | Use max-height animation for very tall content to reduce micro-jank.
|
style | Configure
|
timingFunction | CSS timing function, e.g. `cubic-bezier(0.4, 0, 0.2, 1)`
|
AccordionItem
AccordionItemProps
| Prop / type | Description |
|---|---|
children | Configure
|
disabled | Configure
|
value | Configure
|
AccordionTrigger
AccordionTriggerProps
| Prop / type | Description |
|---|---|
children | Configure
|
class | Configure
|
hideIndicator | Configure
|
id | Configure
|
indicator | Configure
|
onClick | Configure
|
Data Type Reference
Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.
Accordion Props
4 declared fieldsAccordionPropsAccordion.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of AccordionProps before adapting it.AccordionContent Props
5 declared fieldsAccordionContentPropsAccordionContent.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of AccordionContentProps before adapting it.AccordionItem Props
3 declared fieldsAccordionItemPropsAccordionItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of AccordionItemProps before adapting it.valueAccordionTrigger Props
3 declared fieldsAccordionTriggerPropsAccordionTrigger.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of AccordionTriggerProps before adapting it.Accessibility
AccordionTrigger is a button with aria-expanded, aria-controls, and a stable id; AccordionContent is a labeled region with a matching panel id. Disabled items use the button's native disabled state. Accordion defaults to single-item selection. Closed panels stay inert while hidden content unmounts after close animations.
You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.
Connect the Foundation
Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.
Build the Surrounding Screen
Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.
Make the Result Hold Up
Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.
Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.