Ruixen Pro is now live.50+ premium components, templates, blocks, and lifetime updates.

Command Palette

Search for a command to run...

Docs
Indexed Accordion

Indexed Accordion

A minimal accordion with auto-generated zero-padded indices, opacity-driven hierarchy, and spring-timed reveal transitions.

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

PropTypeDefaultDescription
itemsAccordionIndexedItem[]Built-in sampleArray of accordion items
defaultValuestring"engineering"ID of the item open by default
valuestring-Controlled open item ID
onValueChange(value: string) => void-Callback when the open item changes
collapsiblebooleantrueWhether the open item can be collapsed
classNamestring-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 value and defaultValue patterns
  • No icon: Interaction is communicated purely through typography and opacity shifts