Accordion

Designer doc
An accordion is a component that can be expanded or collapsed to show or hide content as needed. It consists of a header, which is shown at all times, and a content, which can be shown / hidden depending on user action.

Example

Basic Usage
Coral Accordion comes in three different styling variants: Contained (default), Outlined, and Borderless.
View code
Controlled Accordion
View code
Basic (Clickable) vs Interactive (Non-Clickable)
Coral Accordion also comes in two different types: Basic (default) and Interactive. This can be set using the clickable property found in AccordionHeader: true and false, respectively.
For Basic accordions, the whole of AccordionHeader is clickable, acting like a Button, to toggle the content. For Interactive accordions, only AccordionExpandButton is.
View code
Icon Customization
By default, AccordionExpandButton will display the Chevron and Caret icons for Basic and Interactive types, respectively. This can be overriden through its children property.
Furthermore, as the user expands / collapses the accordion, the icon will be rotated by 180 degrees for Basic accordions and 90 degrees for Interactive accordions, by default. This can be customised through disableRotate, getTransformFrom, and getTransformTo properties in AccordionExpandButton.
View code
Accordion Group
We can group multiple Accordions into an AccordionGroup to make them behave collectively. With it, we can specify the gap between the Accordion members and the mode: Single or Multiple. Using an AccordionGroup also enables keyboard arrow navigation between accordions.
View code
Controlled Accordion Group
We can control the AccordionGroup by overriding the expandedActiveIndexes and onExpandedIndexesChange props.
View code

API

Accordion
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
indexnumber
initialIsExpandedboolean
isExpandedboolean
onIsExpandedChange(isExpanded: boolean) => void
variantAccordionVariantsAccordionVariants.Contained
AccordionContent
Prop nameTypeDefaultDescription
animatedContainerPropsHTMLAttributes<HTMLDivElement>{}
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
immediateboolean
springPropsRemap<ControllerUpdate<Lookup<any>> & { ref?: SpringRef<Lookup<any>>; }>{}
AccordionExpandButton
Prop nameTypeDefaultDescription
animatedContainerPropsHTMLAttributes<HTMLDivElement>{}
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
colorTypeColorTypes
Set color based on theme. If color is specified, that prop is used instead of this.
disableRotateboolean
disabledboolean
Equivalent to button's disabled property.
getTransformFrom(isExpanded: boolean) => CSSProperties
getTransformTo(isExpanded: boolean) => CSSProperties
immediateboolean
keyboardClickKeysstring[]
loadingboolean
onBlurFocusEventHandler<HTMLDivElement>
onClickMouseEventHandler<HTMLDivElement>
onKeyDownKeyboardEventHandler<HTMLDivElement>
onKeyUpKeyboardEventHandler<HTMLDivElement>
onMouseDownMouseEventHandler<HTMLDivElement>
onMouseLeaveMouseEventHandler<HTMLDivElement>
onMouseUpMouseEventHandler<HTMLDivElement>
onReleaseEventHandler<SyntheticEvent<HTMLDivElement, Event>>
Callback that's triggered after click i.e. mouseup and keyup of enter or space.
onTouchEndTouchEventHandler<HTMLDivElement>
onTouchStartTouchEventHandler<HTMLDivElement>
radiusstring
sizeIconButtonSizes
springPropsRemap<ControllerUpdate<Lookup<any>> & { ref?: SpringRef<Lookup<any>>; }>{}
tooltipReactNode
tooltipPropsOmit<TooltipProps, "title" | "children">
variantIconButtonVariants
AccordionGroup
Prop nameTypeDefaultDescription
expandedIndexesnumber[]
gapnumber0
Minimum gap value is 0
initialExpandedIndexesnumber[][]
modeAccordionGroupModesAccordionGroupModes.Multiple
onExpandedIndexesChange(expandedIndexes: number[]) => void
AccordionHeader
Prop nameTypeDefaultDescription
asany
Tag or component, but a simple tag (i.e. built-in components, e.g. div, span) is recommended.
clickablebooleantrue
leftElementReactNode
leftElementPropsHTMLAttributes<HTMLDivElement>
rightElementReactNode
rightElementPropsHTMLAttributes<HTMLDivElement>
titlePropsHTMLAttributes<HTMLDivElement>
    Example
    Example
    Basic Usage
    Basic Usage
    Controlled Accordion
    Controlled Accordion
    Basic (Clickable) vs Interactive (Non-Clickable)
    Basic (Clickable) vs Interactive (Non-Clickable)
    Icon Customization
    Icon Customization
    Accordion Group
    Accordion Group
    Controlled Accordion Group
    Controlled Accordion Group
    API
    API
    Accordion
    Accordion
    AccordionContent
    AccordionContent
    AccordionExpandButton
    AccordionExpandButton
    AccordionGroup
    AccordionGroup
    AccordionHeader
    AccordionHeader
Coral is a thoroughly developed design system widely adopted by developers and designers for creating beautiful and user-friendly Sea internal products.

Copyright © 2018-2025 Sea Labs