CraftUI

Accordion

Framed rows that expand to show more.

Keep inventory is on, and mobs don't break blocks. Only the host can change these.

Installation

npx shadcn@latest add @runqora/craft-accordion

Usage

import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@/components/craft/accordion";

<Accordion>
  <AccordionItem value="rules">
    <AccordionTrigger>World rules</AccordionTrigger>
    <AccordionContent>Keep inventory is on.</AccordionContent>
  </AccordionItem>
</Accordion>;

Examples

Several open at once

By default, opening an item closes the others. Set multiple to let them stay open.

Props

Accordion

Prop

Type

Accessibility

  • Each trigger is a button in a heading, with aria-expanded telling whether its item is open.
  • Tab moves between triggers, and Enter or Space opens and closes.
  • Set hiddenUntilFound so the browser's find-in-page can search closed items and open the one that matches.

Customization

Items are framed rows with a gap between them. For one continuous list, remove the gap with className="gap-0" on Accordion, and the rows' lines will meet.

Dependencies

Source

On this page