Lynx

Accordion

A component that keeps screens clean and organized by collapsing and expanding related information sections.

Engine ≥ 3.6
Available since@seed-design/lynx-react@0.5.0, @seed-design/lynx-css@0.9.0
Loading Lynx example…

Installation

npx @seed-design/cli@latest add ui:accordion

Props

Accordion

Prop

Type

values?string[] | undefined
defaultValues?string[] | undefined
onValuesChange?((values: string[]) => void) | undefined
disabled?boolean | undefined
multiple?boolean | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

AccordionItem

Prop

Type

valuestring
disabled?boolean | undefined
style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

AccordionTrigger

Prop

Type

titleReact.ReactNode
description?React.ReactNode
prefix?React.ReactNode
suffixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefined
className?string | undefined
bindtap?EventHandler<BaseTouchEvent<Target>> | undefined
expandedAccessibilityValue?string | undefined
collapsedAccessibilityValue?string | undefined
style?CSSProperties | undefined

AccordionContent

Prop

Type

style?CSSProperties | undefined
children?React.ReactNode
className?string | undefined

Examples

Inline Variant

The default variant. Items are displayed in a continuous flow with dividing lines between items.

Loading Lynx example…

Separated

Using variant="separated" displays each item as a separate card.

Loading Lynx example…

Multiple

By default, only one item can be expanded at a time. Using the multiple prop allows multiple items to be expanded simultaneously.

Loading Lynx example…

Always one open

When using values and onValuesChange with a controlled pattern, you can ensure that one item is always open by adding a guard that prevents the setter from being called when an empty array is received.

Loading Lynx example…

Size

Set the size of the Accordion using size. (default: medium)

Lynx supports medium and large. The responsive option that automatically changes based on screen width is not supported, so you should select one of the two values based on screen width in your app if needed.

Loading Lynx example…

Prefix

You can pass leading elements like icons to the prefix prop.

Loading Lynx example…

Description

You can add supplementary descriptions to the trigger using the description prop.

Loading Lynx example…

Disabled

You can disable all or individual items using the disabled prop.

  • Setting disabled on Accordion disables all items.
  • Setting disabled on AccordionItem disables only that item.
Loading Lynx example…

Controlled

You can directly control the open state using values and onValuesChange.

Loading Lynx example…

Value Array Changes

In controlled mode, the currently open items are passed as a values array. The example below shows the latest values and recent onValuesChange results each time the trigger is clicked.

Loading Lynx example…

Default Expanded

You can specify the initial open state using defaultValues.

Loading Lynx example…

Custom Content

AccordionContent serves only as an open/close animation container. It does not provide default padding, background color, borders, or typography styles, so you must configure these directly in the internal content. We recommend the pattern of explicitly providing padding and background using Box as shown in the example below.

Loading Lynx example…

Web Version Differences

The Lynx Accordion has the following differences from the React version.

  • Native elements: Renders Lynx <view> and <text> instead of HTML heading, button, and region.
  • Interaction: Opens and closes items via the Trigger's native tap event instead of keyboard navigation.
  • Accessibility: Uses accessibility-heading, accessibility-role-description, and accessibility-value instead of DOM ARIA.
  • Responsive size: Lynx preset does not support viewport media queries, so size="responsive" is not provided.
  • Content transition: The React version passes height via CSS custom property, while the Lynx version measures content height with layoutchange and applies transitions with the same duration and easing.

Unsupported Lynx Features

FeatureDescription
asChildLynx does not have Slot-based polymorphic rendering.
headingLevelLynx heading accessibility attributes do not accept HTML heading levels.
DOM ARIA ConnectionUse Lynx native accessibility attributes instead of aria-controls, aria-labelledby, and role="region".
Arrow / Home / End Key NavigationLynx native screens do not have a keyboard focus model like the web.
size="responsive"Lynx preset does not support viewport media queries.

Table of contents