DocsComponentsTemplatesThemesGitHub

Accordion

Expandable sections for FAQs and grouped settings.

Code

import * as React from 'react';
import { Accordion } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        maxWidth: 460,
      }}
    >
      <Accordion
        defaultValue={['0']}
        items={[
          {
            title: 'What’s included in the free plan?',
            content: 'Up to 3 projects and 5 collaborators.',
          },
          {
            title: 'Can I change plans later?',
            content: 'Yes, any time from Settings.',
          },
          {
            title: 'How do refunds work?',
            content: 'Contact support within 14 days.',
          },
        ]}
      />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Accordion } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/accordion.json

Guidelines

  • multiple allows several open.

Props

PropTypeRequired
itemsArray<{ value?: string; title: React.ReactNode; content: React.ReactNode }>Yes
valuestring[]No
defaultValuestring[]No
onChange(open: string[]) => voidNo
multiplebooleanNo
classNamestringNo

Edit this example on GitHub