Playground GitHub npm

Accordion

Single-open collapsible with animated height + chevron swap.

ui display

Preview

Installation

npx slintcn@latest add accordion

Usage

import { Accordion, AccordionItem } from "slintcn/components/accordion.slint";

Accordion {
    open-index <=> open;
    items: [
        { title: "Is it accessible?", content: "Yes — keyboard + Space toggle." },
        { title: "Is it styled?", content: "Dark glass by default." },
    ];
}

Properties

items in [AccordionItem]

Sections shown stacked; each `{ title, body }` renders as one row.

open-index in-out int

Index of the expanded item; -1 means all closed.

changed callback (int)

Fired when a section is toggled; argument is the new `open-index`.

API

Accessibility
focusableyes
keyboardEnterSpace

Dependencies

iconlucide-pathsseparator

Installed automatically as transitive dependencies of slintcn add accordion.