Skip to main content

Section

A collapsible content panel with an optional icon and title. Use it to divide a page or card into named, optionally togglable groupings. Supports both controlled and uncontrolled expand state.

πŸ“– Storybook

Preview​

Import​

import { Section } from "@xocialive/ui-components";

Basic usage​

<Section textOverrides={{ title: "User Details" }}>
<p>Content goes here.</p>
</Section>

Non-collapsible​

<Section collapsible={false} textOverrides={{ title: "Summary" }}>
{/* content */}
</Section>

Controlled expand state​

const [open, setOpen] = useState(true);

<Section expanded={open} onToggle={setOpen} textOverrides={{ title: "Filters" }}>
{/* filter fields */}
</Section>;

Props​

PropTypeDefaultDescription
textOverrides.titlestringβ€”Section heading text
iconReactNodeβ€”Icon rendered before the title
collapsiblebooleantrueWhether the section can be collapsed
defaultExpandedbooleantrueInitial expand state (uncontrolled)
expandedbooleanβ€”Controlled expand state
onToggle(expanded: boolean) => voidβ€”Called when the user toggles the section
childrenReactNodeβ€”Section body content