Last modified: 4/Oct/2024
Collapse
A content area which can be collapsed and expanded.
The children of the Collapse component is CollapseItem.
#Usage
<Collapse defaultKeys={[1]}> <Collapse.CollapseItem header={<div style={{ padding: 16 }}>Obi-Wan</div>} position={1} > <div style={{ padding: 16 }}>R2D2</div> </Collapse.CollapseItem> <Collapse.CollapseItem header="Qui-Gon" position={2}> You must learn the ways of the Force if youre to come with me to Alderaan. </Collapse.CollapseItem> <Collapse.CollapseItem header="Mace" position={3}> You must learn the ways of the Force if youre to come with me to Alderaan. </Collapse.CollapseItem> </Collapse>
#Props
#mode
modeTypes
The animation direction for an item
#defaultKeys
number[]
Items expanded on load. The
position
prop needs to be set in the Collapse.Item as well.#onChange
(key: number) => void
The callback that runs when the active collapse item is changing
#isAccordion
boolean
Decides whether the Collapse is as an accordion (only one item can be open at a time) or not.
#isCollapsedByDefault
boolean
Decides whether the Collapse items are collapsed by default.
#CollapseItem Props
#children
React.ReactNode
#header
ReactElement ǀ string
#position
number
defaultKeys
prop #isCollapsible
boolean
#onStateChange
(isOpen: boolean) => void
#Types
CollapseInterface
: props of theCollapse
component processed by stratus extended byOmit<HTMLAttributes<HTMLDivElement>, 'onChange'>
Read more about types here