UIR

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-accordion

Usage

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

PropTypeDefault
items

{ key, title, content, icon? }. content can be a string or any element.

SplitAccordionItem[]โ€”
multiple

Let more than one item be open at once.

booleanfalse
value

Controlled open keys.

string[]โ€”
defaultValue

Keys open at the start when uncontrolled.

string[][]
onValueChange

Called when an item is opened or closed.

(keys: string[]) => voidโ€”
radius

Corner radius of a separated card.

number16
gap

Space that opens around an open item.

number10
borderColor

Card border.

string"#e9e9ec"
backgroundColor

Closed item background.

string"#ffffff"
openBackgroundColor

Open item background.

string"#fafafa"
textColor

Title colour.

string"#111"
mutedColor

Icon, chevron and content text colour.

string"#555"