Rost

← All components

component

Accordion

Several things that open one by one, like questions and answers: Disclosures in a column, a line between each.

In code Contract: review Guidance: proposed Contract on GitHub Figma 745:29 As markdown

Try it

Every variant

What counts as an expense?

The short answer, in a sentence or two.

When is tax due?

The short answer, in a sentence or two.

Can I export my data?

The short answer, in a sentence or two.

Default

Install

npx github:Runceanu/rost add accordion

It lands in src/rost/accordion/, with what it needs and its contract. Install has the rest.

When to use

  • Questions and answers

    A few questions where most people need one answer: what counts as a business expense, when tax is due.

When not to use

  • Things everyone needs

    If most people open every item, show them open.

  • One thing to hide

    A single detail out of the way is one Disclosure.

    Use Disclosure

Behaviour

Each item opens on its own; opening one doesn't close the others. It's Disclosures in a column with lines between them.

Accessibility

  • Element

    A <div> of <details>, so each summary is a button the browser knows opens.

  • Keyboard

    Tab moves between summaries; Enter or Space opens and closes.

  • Colour

    The lines are decoration.

Props

PropTypeValuesDefault
items slot

Values

Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.

Never changes

root

displayflex · flex-directioncolumn

item

  • padding-top 12px spacing/gap/small-medium
  • padding-bottom 12px spacing/gap/small-medium
  • border-bottom-width 1px spacing/outline/small
  • border-bottom-color #3a3a3a accordion/divider

border-bottom-stylesolid