Accordion

Accordion

import Accordion, { AccordionSection } from "@kiwicom/orbit-components/lib/Accordion";
<Accordion>
<AccordionSection>Hello World!</AccordionSection>
</Accordion>

Props

NameTypeRequiredDefaultDescription
childrenReact.ReactNodeThe content of the Accordion. You can use only AccordionSection
expandedSectionstring \| numberOptional prop to control which AccordionSection (by id) is expanded
loadingbooleanfalseIf true it will render the Loading component
onExpand(sectionId: string \| number) => void \| Promise<any>Callback (along with sectionId) that is triggered when section is expanding
dataTeststringOptional prop for testing purposes
idstringSet id for Accordion
spaceAfter"none" \| "smallest" \| "small" \| "normal" \| "medium" \| "large" \| "largest"Additional space after the component

AccordionSection

Props

NameTypeRequiredDefaultDescription
idstringUnique identifier for the section, used by expandedSection
childrenReact.ReactNodeThe content of the AccordionSection
actionsReact.ReactNodeAdditional actions to be displayed in the header
expandablebooleantrueWhether the section can be expanded
expandOnTileClickbooleanfalseEnables mobile-first interaction where the entire header area becomes clickable for expansion
headerReact.ReactNodeThe content of the section header
footerReact.ReactNodeAdditional content to display at the bottom of an expanded section
dataTeststringOptional prop for testing purposes

Functional specs

  • By default, the Accordion component operates in an uncontrolled mode. For programmatic control, use the expandedSection and onExpand props together.