Components
Accordion
Collapsible sections for FAQs and organized content
Accordion components display collapsible content sections, useful for FAQs and organizing information.
Basic Usage
<SimpleAccordion client:load items={[
{ title: "What is Barodoc?", content: "Barodoc is a documentation framework..." },
{ title: "How do I get started?", content: "Install with pnpm add @barodoc/core..." },
{ title: "Is it free?", content: "Yes, Barodoc is open source..." }
]} />
With Icons
π
βοΈ
π¦
<SimpleAccordion client:load items={[
{ title: "Getting Started", content: "Follow our quickstart guide...", icon: "π" },
{ title: "Configuration", content: "Customize your documentation...", icon: "βοΈ" },
{ title: "Deployment", content: "Deploy your documentation...", icon: "π¦" }
]} />
Multiple Open
Allow multiple items to be open simultaneously with type="multiple":
<SimpleAccordion client:load type="multiple" items={[
{ title: "Frontend", content: "React, Vue, Svelte..." },
{ title: "Backend", content: "Node.js, Python, Go..." },
{ title: "Database", content: "PostgreSQL, MySQL, MongoDB..." }
]} />
Default Open
Set initially open items with defaultValue:
This is open by default.
<SimpleAccordion client:load defaultValue="item-1" items={[
{ title: "First Item", content: "This is closed by default." },
{ title: "Second Item", content: "This is open by default." },
{ title: "Third Item", content: "This is also closed by default." }
]} />
Props
itemsAccordionItem[]requiredArray of accordion items (see Accordion Item below)
type'single' | 'multiple'default: 'single'Whether one or multiple items can be open at once
collapsiblebooleandefault: trueAllow closing all items when type is βsingleβ
defaultValuestring | string[]Initially open item(s) - use βitem-0β, βitem-1β, etc.
client:loaddirectiverequiredRequired Astro directive for client-side interactivity
Accordion Item
Each item in the items array:
titlestringrequiredAccordion header text
contentstringrequiredContent shown when accordion is expanded
iconstringOptional emoji or icon to display