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.
π StorybookPreviewβ
Live previewβ Open in Storybook
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β
| Prop | Type | Default | Description |
|---|---|---|---|
textOverrides.title | string | β | Section heading text |
icon | ReactNode | β | Icon rendered before the title |
collapsible | boolean | true | Whether the section can be collapsed |
defaultExpanded | boolean | true | Initial expand state (uncontrolled) |
expanded | boolean | β | Controlled expand state |
onToggle | (expanded: boolean) => void | β | Called when the user toggles the section |
children | ReactNode | β | Section body content |