Collapse

An expandable disclosure with a summary.

summary is required and accepts markup — for example, text with a Badge. Set defaultOpen initially, or open with onOpenChange for a controlled disclosure.

Live example

Summary

Example controls

Usage

import { Collapse } from '@prosazhin/pbcomponents';

<Collapse summary='Summary'>Collapse item content</Collapse>;

Component API

PropType / variantsPurposeDefault
summaryReactNodeExpandable section heading: text or markup, for example with a Badge.—
childrenReactNodeContent of the expanded section.—
openbooleanControlled open state.—
defaultOpenbooleanInitial open state when uncontrolled.false
onOpenChange(open: boolean) => voidCalled when the section opens or closes.—
contentClassNamestringClass of the expanded content.—
classNamestringClass of the root element.—

Native HTML attributes are accepted where the component renders the corresponding element. className props only affect styling.