Is it accessible?
Yes. It adheres to the WAI-ARIA design pattern.
Is it styled?
Yes. It comes with default styles that matches the other components' aesthetic.
Is it animated?
Yes. It's animated by default, but you can disable it if you prefer.
A vertically stacked set of interactive headings that each reveal a section of content.
Yes. It adheres to the WAI-ARIA design pattern.
Yes. It comes with default styles that matches the other components' aesthetic.
Yes. It's animated by default, but you can disable it if you prefer.
import { Accordion, AccordionItem, Text } from '@photonix/ultimate';
<Accordion defaultValue={['item-1']}>
<AccordionItem value="item-1" label="Is it accessible?">
<Text variant="body-md" color="secondary">
Yes. It adheres to the WAI-ARIA design pattern.
</Text>
</AccordionItem>
<AccordionItem value="item-2" label="Is it styled?">
<Text variant="body-md" color="secondary">
Yes. It comes with default styles that matches the other components' aesthetic.
</Text>
</AccordionItem>
</Accordion>Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string[] | [] | Default expanded items (uncontrolled) |
value | string[] | - | Controlled expanded items |
onValueChange | ((value: string[]) => void) | - | Callback when expanded items change |
allowMultiple | boolean | false | Allow multiple items to be expanded |
variant | "default" | "outlined" | "elevated" | 'outlined' | Visual variant of the accordion container |
children | React.ReactNode | - | Children elements |
Prop | Type | Default | Description |
|---|---|---|---|
value | string | - | Unique value for this item |
isDisabled | boolean | false | Whether this item is disabled |
label | string | - | Label text for the accordion header |
description | string | - | Description text (optional) |
leadingIcon | React.ReactNode | - | Leading icon (optional) |
children | React.ReactNode | - | Children elements (content when expanded) |
className | string | - | Additional class name |
Set allowMultiple prop to allow expanding multiple items at once.
This item is expanded by default.
This item is also expanded by default independently.
Click to expand me without closing others.
import { Accordion, AccordionItem, Text } from '@photonix/ultimate';
<Accordion allowMultiple defaultValue={['item-1', 'item-2']}>
<AccordionItem value="item-1" label="First Item">
<Text variant="body-md" color="secondary">
This item is expanded by default.
</Text>
</AccordionItem>
<AccordionItem value="item-2" label="Second Item">
<Text variant="body-md" color="secondary">
This item is also expanded by default independently.
</Text>
</AccordionItem>
<AccordionItem value="item-3" label="Third Item">
<Text variant="body-md" color="secondary">
Click to expand me without closing others.
</Text>
</AccordionItem>
</Accordion>You can add leading icons to the accordion trigger using the leadingIcon prop.
Important information goes here.
Be careful with this action.
import { InformationOutline, WarningOutline } from '@photonix/icons';
import { Text } from '@photonix/ultimate';
<Accordion>
<AccordionItem value="info" label="Information" leadingIcon={<InformationOutline />}>
<Text variant="body-md" color="secondary">Important information goes here.</Text>
</AccordionItem>
<AccordionItem value="warning" label="Warning" leadingIcon={<WarningOutline />}>
<Text variant="body-md" color="secondary">Be careful with this action.</Text>
</AccordionItem>
</Accordion>Disable specific items using the isDisabled prop.
This item functions normally.
You cannot expand this item.
import { Accordion, AccordionItem, Text } from '@photonix/ultimate';
<Accordion>
<AccordionItem value="item-1" label="Enabled Item">
<Text variant="body-md" color="secondary">This item functions normally.</Text>
</AccordionItem>
<AccordionItem value="item-2" label="Disabled Item" isDisabled>
<Text variant="body-md" color="secondary">You cannot expand this item.</Text>
</AccordionItem>
</Accordion>