Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import Accordion, AccordionItem, AccordionTrigger, and AccordionContent.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy 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 SetupTypeScript
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 SetupTypeScript
import { Accordion } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Usage PatternTypeScript
<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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Multiple

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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Disabled

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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Borders

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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Card

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 Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props 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.

API reference
Your API, from source

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

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? 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.
@kamod-ch/ui/accordion14.0 KB min · 3.4 KB gzipSignals: direct@preact/signals

Accordion

AccordionProps

Accordion documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildAccordionProps

Configure children for Accordion. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
collapsible
booleanAccordionProps

When `type="single"`, `false` keeps one panel always open (clicking the open trigger does not close it). Default `true` matches common shadcn examples.

Default
true
defaultValue
string | string[]AccordionProps

Configure defaultValue for Accordion. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
type
AccordionTypeAccordionProps

Configure type for Accordion. Compare its accepted type with the Usage Guidance before supplying a value.

Default
"single"

AccordionContent

AccordionContentProps

AccordionContent documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildAccordionContentProps

Configure children for AccordionContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>AccordionContentProps

Configure class for AccordionContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
duration
stringAccordionContentProps

Grid transition duration, e.g. `400ms`

Default
"320ms"
forceMount
booleanAccordionContentProps

Configure forceMount for AccordionContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
id
string | SignalLike<string | undefined>AccordionContentProps

Configure id for AccordionContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
largeContentThreshold
numberAccordionContentProps

Use max-height animation for very tall content to reduce micro-jank.

Default
560
style
string | CSSProperties | SignalLike<string | CSSProperties | undefined>AccordionContentProps

Configure style for AccordionContent. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
timingFunction
stringAccordionContentProps

CSS timing function, e.g. `cubic-bezier(0.4, 0, 0.2, 1)`

Default
"cubic-bezier(0.22, 1, 0.36, 1)"

AccordionItem

AccordionItemProps

AccordionItem documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildAccordionItemProps

Configure children for AccordionItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
booleanAccordionItemProps

Configure disabled for AccordionItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
value
stringAccordionItemProps

Configure value for AccordionItem. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

AccordionTrigger

AccordionTriggerProps

AccordionTrigger documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildAccordionTriggerProps

Configure children for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
string | SignalLike<string | undefined>AccordionTriggerProps

Configure class for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
hideIndicator
booleanAccordionTriggerProps

Configure hideIndicator for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
false
id
string | SignalLike<string | undefined>AccordionTriggerProps

Configure id for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
indicator
ComponentChild[] | ComponentChildAccordionTriggerProps

Configure indicator for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onClick
MouseEventHandler<HTMLButtonElement>AccordionTriggerProps

Configure onClick for AccordionTrigger. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

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 fields
AccordionProps
Exported Source Declaration from Accordion.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 fields
AccordionContentProps
Exported Source Declaration from AccordionContent.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 fields
AccordionItemProps
Exported Source Declaration from AccordionItem.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of AccordionItemProps before adapting it.
Required fields
value

AccordionTrigger Props

3 declared fields
AccordionTriggerProps
Exported Source Declaration from AccordionTrigger.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.

Take the Next Useful Step

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.