You are currently viewing outdated (<=3.x) Chameleon documentation on our old website. For version >=4.x, check out our new website.

Current release: 3.5.0 | hub

components

Accordion (code)

An accordion component is a list of items, allowing each item's content to be expanded and collapsed by clicking its header.

Lorem ipsum dolor sit amet
Neque porro quisquam est qui
Maecenas pellentesque quam nec aliquam tempus
import { Accordion, AccordionItem } from '@mediahuis/chameleon-react'

Props

NameTypeDefaultRequiredDescription
childrenNode--Children of type AccordionItem
collapsibleBoolean--Whether or not when clicking on an AccordionItem it can collapse again.
idString-trueThe Accordion's id (Needed for a11y implementation)
initialExpandedIndexNumber-1-The initial expanded/open AccordionItem index started at 0. -1 means all
onChangeFunction() => {}-Callback function when an item inside the Accordion changes the expandedIndex

System Props

System Props

Next to the properties listed in the propstable, a collection of system props can be added to any component for further general styling and layouting purposes. These props vary per component.

To read more about the system, click here to check out its dedicated page.

Children

All direct children of an Accordion must be AccordionItem components. However, the children of the AccordionItem components can be any component.

Lorem ipsum dolor sit amet
Neque porro quisquam est qui
Maecenas pellentesque quam nec aliquam tempus

InitialExpandedIndex

default: -1

To have one item open by default on initial render, pass in the initialExpandedIndex index.

Lorem ipsum dolor sit amet
Neque porro quisquam est qui

Maecenas risus tellus, pulvinar ullamcorper aliquam ut, luctus quis nisl. Donec laoreet mi ac nunc fringilla facilisis. Aliquam sollicitudin ligula ut ligula dignissim, sed placerat magna scelerisque. Sed ac nulla vel sem condimentum maximus eu quis tellus.

Maecenas pellentesque quam nec aliquam tempus

Collapsible

default: false

By default, once an item has been opened, it can only be closed by opening another. If you want to allow users to close all items, set collapsible to true.

Lorem ipsum dolor sit amet
Neque porro quisquam est qui
Maecenas pellentesque quam nec aliquam tempus

© Copyright 2020 Mediahuis NV. All rights Reserved