You are viewing a PR preview for PR #1819

Agriculture Design System
Beta
Design System for the Export Service

Accordion

An accordion lets users show and hide sections of related content.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/accordion';

Usage

Accordion components can be imported via the accordion entrypoint in the @ag.ds-next/react package.

For example:

import { ... } from '@ag.ds-next/react/accordion';

Props

Accordion Props
PropTypeDescription
childrenReactNode
AccordionItem Props
PropTypeDescription
titleReactNode
The title of the accordion item.
background?"body" | "bodyAlt"
If the Accordion is placed on a page with 'bodyAlt' background, please set this to 'bodyAlt'.
children?ReactNode
isInitiallyOpen?booleanDefault: false
If true, the item will initially be rendered in an open state.
isOpen?boolean
The current open state.
onToggle?(() => void)
Handle open/close events.
titleHeadingTag?"h1" | "h2" | "h3" | "h4" | "h5" | "h6"Default: "h3"
The underlying HTML tag of the title element.
AccordionItemContent Props
PropTypeDescription
childrenReactNode

Source

You can view the full source code for this package on Github.