Skip to content

Accordion

Sections one below the other that open and close: questions and answers, settings by topic.

import { Accordion, AccordionSkeleton } from '@sypnia/ui/react'

On this page
  1. Questions and answers
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

Questions and answers

One open at a time.

A place for your tables, your keys and your team. Each project has its own address and its own bill.

Code
import { Accordion } from '@sypnia/ui/react';

// One section open at a time; the first starts open. Tab moves between the titles, Enter or Space opens one.
export default function Questions() {
  return (
    <Accordion defaultOpen={['what']} items={[
      { id: 'what', title: 'What is a project?', content: 'A place for your tables, your keys and your team. Each project has its own address and its own bill.' },
      { id: 'invite', title: 'Can I invite people who do not program?', content: 'Yes. They see the data as tables and cards, and change only what their role allows.' },
      { id: 'delete', title: 'What happens when I delete a project?', content: 'It stops answering at once. Its data is kept for 7 days in case you change your mind; after that it is gone.' },
    ]} />
  );
}

Skeleton

The real piece and its skeleton: the same box, so nothing moves when the data arrives.

Code
import { Accordion, AccordionSkeleton } from '@sypnia/ui/react';

export default function Skeleton() {
  return (
    <div className="sy-stack">
      <Accordion items={[{ id: 'a', title: 'Billing', content: 'Monthly, on the 1st.' }, { id: 'b', title: 'Limits', content: '5 million requests.' }]} />
      <AccordionSkeleton items={2} />
    </div>
  );
}

When to use it

Use it when

  • Many sections where people read one or two.

Do not use it when

  • Everything is short: show it open.
  • There is only one: Disclosure.

For everyone

  • Each title is a button inside a heading, and says whether it is open. Enter or Space opens it.
  • With multiple more than one can be open.

Props

AccordionTypeDefault
itemsrequired AccordionItem[]
defaultOpen string[]
multiple boolean
AccordionSkeletonTypeDefault
items number 4
  1. Questions and answers
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms