Skip to main content

Accordion

Usage

Accordions provide a quick way to vertically show or hide content and functionality.

Common Characteristics

All accordions have a label that toggles content below it to show or hide.

A 150ms transition is used to expand the content area down, and 75ms to collapse it up.

Filter Accordion

The filter accordion accommodates a clear function that clears all selections within a filter category. It is hidden when there are no selections.

The content panel height can be specified as needed, and supports internal scrolling if needed. Expanding a content panel does not change the state of any other filter section.

Makes
Models
VIN

Each menu accordion content panel accommodates the height of its content and does not allow internal scrolling. Expanding one content panel collapses any other expanded section.

Item 1
Accordion Content
Item 2
Accordion Content
Item 3
Accordion Content

Code

Default Accordion

Live Editor
Result
Loading...

Accordion Closed

Live Editor
Result
Loading...

Accordion Items are all open by default unless open is set to false.


Open an Accordion Item

Live Editor
Result
Loading...

To set an Accordion Item to open by default, set defaultOpen to true on that item.


Open all Accordion Items

Live Editor
Result
Loading...

collapseSiblings prop has to be set when using open to prevent other accordion items closing when closing one of the items. Otherwise it will have confusing behavior.

Accordion with an onChange Callback Function

Explicitly adding ids to Accordion Item/Input components is recommended. UUIDs are generated by default.

Live Editor
Result
Loading...

Filter Accordion

Live Editor
Result
Loading...

Accordion Input / Filter Accordion Variant

Live Editor
Result
Loading...

Clearble Accordion Input

Live Editor
Result
Loading...

The Accordion.Input is a controlled component, since it is meant to be used with inputs as children. To use the clearble/onClear feature, manage the state of the component from your app. The onClear function returns a boolean value: true when it is clicked.

Accordion Props

propertypropTyperequireddefaultdescription
openbool-false
idstring--

Accordion.Item Props

propertypropTyperequireddefaultdescription
isOpenbool-true
triggerTagstring-'div'
idstring--
triggerClassNamestring--
childrennode--
defaultOpenbool--
titlestring--
variantstring--
onClearfunc--
onChangefunc--
clearablebool--

Accordion.Input Props

propertypropTyperequireddefaultdescription
idstring--
childrennode--
onClearfunc--
defaultOpenbool--
onChangefunc--
clearablebool--
onSubmitfunc--