Disclosure

Accordion

Stacks sections so people can open only what they need.

Installation

npx sinaui add accordion

Examples

Basic

Any number of sections can be open.

What was the House of Wisdom?
A library and translation center in Abbasid Baghdad, where scholars rendered Greek, Persian and Indian works into Arabic.
Who worked there?
Al-Khwarizmi, the Banu Musa brothers and Hunayn ibn Ishaq, among many others.
What became of it?
It was destroyed in the Mongol siege of Baghdad in 1258.
<script lang="ts">
	import * as Accordion from '#lib/ui/accordion/index.js';
</script>

<Accordion.Root>
	<Accordion.Item title="What was the House of Wisdom?">
		A library and translation center in Abbasid Baghdad, where scholars rendered Greek, Persian and
		Indian works into Arabic.
	</Accordion.Item>
	<Accordion.Item title="Who worked there?">
		Al-Khwarizmi, the Banu Musa brothers and Hunayn ibn Ishaq, among many others.
	</Accordion.Item>
	<Accordion.Item title="What became of it?">
		It was destroyed in the Mongol siege of Baghdad in 1258.
	</Accordion.Item>
</Accordion.Root>

One at a time

Opening a section closes the others, using the browser's own details grouping.

Algebra
From al-Khwarizmi's al-Jabr, about restoring and balancing equations.
Algorithm
From the Latin form of al-Khwarizmi's own name.
Alchemy
From Arabic al-kimiya, itself borrowed from Greek.
<script lang="ts">
	import * as Accordion from '#lib/ui/accordion/index.js';
</script>

<!-- One open at a time, using the browser's native <details name> grouping. -->
<Accordion.Root exclusive>
	<Accordion.Item title="Algebra" open>
		From al-Khwarizmi's al-Jabr, about restoring and balancing equations.
	</Accordion.Item>
	<Accordion.Item title="Algorithm">From the Latin form of al-Khwarizmi's own name.</Accordion.Item>
	<Accordion.Item title="Alchemy">
		From Arabic al-kimiya, itself borrowed from Greek.
	</Accordion.Item>
</Accordion.Root>

Props

PartProps
Accordion.Rootexclusive: one item open at a time
Accordion.Itemtitle (required), open (bindable)

Accessibility

  • Built on <details> and <summary>: expanded state, keyboard and screen reader support come from the browser.
  • In Chromium, find-in-page opens a closed section that contains the match; other browsers don't search closed sections yet.
  • Opening animates height where supported (Chromium today) and is instant elsewhere and under reduced motion.
KeyAction
Enter / SpaceOpens or closes the focused section.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme