Installation
Usage
import AccordionIndexed from "@/components/ruixen/accordion-indexed";
export default function About() {
return <AccordionIndexed />;
}Custom Data
const myItems = [
{
id: "mission",
title: "Our Mission",
content: "Building tools that empower creators.",
},
{
id: "vision",
title: "Our Vision",
content: "A world where great design is accessible.",
},
{
id: "values",
title: "Our Values",
content: "Simplicity, craft, and attention to detail.",
},
];
<AccordionIndexed items={myItems} defaultValue="mission" />;Controlled
const [open, setOpen] = useState("design");
<AccordionIndexed value={open} onValueChange={setOpen} />;Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | AccordionIndexedItem[] | Built-in sample | Array of accordion items |
defaultValue | string | "engineering" | ID of the item open by default |
value | string | - | Controlled open item ID |
onValueChange | (value: string) => void | - | Callback when the open item changes |
collapsible | boolean | true | Whether the open item can be collapsed |
className | string | - | Additional CSS classes for container |
Item Structure
interface AccordionIndexedItem {
id: string;
title: string;
content: string;
}Features
- Auto-indexed: Display numbers are generated from array position, IDs stay semantic
- Opacity hierarchy: Five levels of opacity create depth without color or weight
- Spring-timed reveal: Index number materializes with cubic-bezier(0.16, 1, 0.3, 1) easing
- Controlled & uncontrolled: Works with both
valueanddefaultValuepatterns - No icon: Interaction is communicated purely through typography and opacity shifts

