You are viewing a PR preview for PR #1506

Agriculture Design System
Beta
Design System for the Export Service

Accordion

An accordion hides sections of content users can choose to see if it is relevant to them.

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
titleReactNodeThe 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?booleanThe 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.