Pular para o conteúdo principal

Accordion

An accordion is a collapsible content component that allows users to expand and collapse sections of content. It's commonly used to organize information into manageable sections, improving the user experience by reducing visual clutter.

The accordion is a compound component composed of Root, Item, Header, and Content subcomponents.

Usage

Example
import { Accordion } from "@tiendanube/nube-sdk-jsx";

<Accordion.Root defaultValue="item-1" style={{ backgroundColor: "red" }}>
<Accordion.Item value="item-1">
<Accordion.Header showIcon>Accordion Item 1</Accordion.Header>
<Accordion.Content>Accordion Content 1</Accordion.Content>
</Accordion.Item>
<Accordion.Item value="item-2">
<Accordion.Header>Accordion Item 2</Accordion.Header>
<Accordion.Content>Accordion Content 2</Accordion.Content>
</Accordion.Item>
</Accordion.Root>;

Subcomponents

Accordion.Root

The root container that manages the accordion state.

PropertyTypeRequiredDescription
childrenNubeChildrenComponentNoAccordion items to be rendered.
defaultValuestringNoDefault expanded item value.
styleStyleSheetNoCustom styles for the accordion root.
idstringNoOptional unique identifier for the component.

Accordion.Item

Individual accordion item container.

PropertyTypeRequiredDescription
childrenNubeChildrenComponentNoHeader and content components.
idstringNoOptional unique identifier for the component.
styleStyleSheetNoCustom styles for the accordion item.

Accordion.Header

The clickable header that toggles the accordion item.

PropertyTypeRequiredDescription
childrenstringNoText content of the header.
showIconbooleanNoWhether to show expand/collapse icon.
styleStyleSheetNoCustom styles for the header.

Accordion.Content

The collapsible content area of the accordion item.

PropertyTypeRequiredDescription
childrenNubeChildrenComponentNoContent to be displayed when item is expanded.
styleStyleSheetNoCustom styles for the content area.