Installation
Usage
import AccordionEditorial from "@/components/ruixen/accordion-editorial";
export default function About() {
return <AccordionEditorial />;
}Custom Data
const myItems = [
{
id: "mission",
title: "Our Mission",
content: "Building tools that empower creators worldwide.",
},
{
id: "vision",
title: "Our Vision",
content: "A world where great design is accessible to everyone.",
},
{
id: "values",
title: "Our Values",
content: "Simplicity, craft, and relentless attention to detail.",
},
];
<AccordionEditorial items={myItems} defaultValue="mission" />;Controlled
const [open, setOpen] = useState("clarity");
<AccordionEditorial value={open} onValueChange={setOpen} />;Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | AccordionEditorialItem[] | Built-in sample | Array of accordion items |
defaultValue | string | "restraint" | 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 AccordionEditorialItem {
id: string;
title: string;
content: string;
}Features
- Pull-quote accent: Left border on expanded content creates an editorial blockquote feel
- Hover micro-translation: 1px rightward nudge on hover for tactile feedback
- Border-less layout: Items separated by spacing alone, no visible dividers
- Spring-timed transitions: cubic-bezier(0.16, 1, 0.3, 1) easing on all state changes
- Controlled & uncontrolled: Works with both
valueanddefaultValuepatterns

