SplitAccordion
A grouped list that looks like one card. Open an item and it breaks away from its neighbours: gaps open, corners round on both sides of the split, and the content grows in.
Preview
Preview coming soon
Try it live: run the CLI command below in an Expo app, or open the Code tab.
Installation
npx @codewithrabby/ui@latest add split-accordionUsage
import { SplitAccordion } from "@/components/uir/split-accordion";
import { Fingerprint, Layers } from "lucide-react-native";
<SplitAccordion
items={[
{ key: "what", title: "What is Interaction Design?", content: "Designing how people use interfaces.", icon: Fingerprint },
{ key: "patterns", title: "Principles & Patterns", content: <MyRichContent />, icon: Layers },
]}
defaultValue={["what"]}
// multiple // allow several open at once
// value / onValueChange for controlled use
/>Props
| Prop | Type | Default |
|---|---|---|
items{ key, title, content, icon? }. content can be a string or any element. | SplitAccordionItem[] | โ |
multipleLet more than one item be open at once. | boolean | false |
valueControlled open keys. | string[] | โ |
defaultValueKeys open at the start when uncontrolled. | string[] | [] |
onValueChangeCalled when an item is opened or closed. | (keys: string[]) => void | โ |
radiusCorner radius of a separated card. | number | 16 |
gapSpace that opens around an open item. | number | 10 |
borderColorCard border. | string | "#e9e9ec" |
backgroundColorClosed item background. | string | "#ffffff" |
openBackgroundColorOpen item background. | string | "#fafafa" |
textColorTitle colour. | string | "#111" |
mutedColorIcon, chevron and content text colour. | string | "#555" |