Components
Accordion

Accordion

The Accordion component provides you with expandable sections for FAQ and content organization.

Live Examples

Storybook: components-accordion--default
Storybook: components-accordion--controlled
Storybook: components-accordion--multiple

Code Examples

import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@nostromo/ui-core'
 
export default function AccordionExample() {
  return (
    <Accordion type="single" collapsible>
      <AccordionItem value="item-1">
        <AccordionTrigger>What is Nostromo UI?</AccordionTrigger>
        <AccordionContent>
          Nostromo UI is a comprehensive UI library built with React, TypeScript and Tailwind CSS.
        </AccordionContent>
      </AccordionItem>
      <AccordionItem value="item-2">
        <AccordionTrigger>How do I install it?</AccordionTrigger>
        <AccordionContent>
          You can install it with npm: <code>npm install @nostromo/ui-core</code>
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  )
}

Multiple Items

import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@nostromo/ui-core'
 
export default function MultipleAccordion() {
  return (
    <Accordion type="multiple">
      <AccordionItem value="item-1">
        <AccordionTrigger>Section 1</AccordionTrigger>
        <AccordionContent>Content in section 1</AccordionContent>
      </AccordionItem>
      <AccordionItem value="item-2">
        <AccordionTrigger>Section 2</AccordionTrigger>
        <AccordionContent>Content in section 2</AccordionContent>
      </AccordionItem>
    </Accordion>
  )
}

Props

PropTypeDefaultDescription
type"single" | "multiple""single"Accordion type
collapsiblebooleanfalseWhether items can be closed