Agriculture Design System
Beta
Design System for the Export Service

Details

The Details component hides non-essential content unless a user explicitly chooses to view it.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/details';
Open in Playroom, opens in a new tab
<Details label="This is an example of a long label" iconBefore>
	<Text as="p">
		This is a small paragraph of text that is supplementary to the main page
		content.
	</Text>
</Details>

Information is visible only when the widget is toggled into an ‘open’ state. Unlike Accordion, inner content is discoverable in a page search (cmd/ctrl-f) in some browsers, like Google Chrome.

Details should only be used for 1 piece of content. If more sections are required, use an Accordion or Tab.

Setting the iconBefore prop to true will render the InfoIcon before the label.

Do

  • use sparingly, and only when users need additional information
  • position the component before a form and avoid using it between between from controls
  • position immediately after the related content
  • use instead of tooltips or Modal where possible
  • use short sentences
  • include a clear description
  • consider using an accordion if there are multiple paragraphs of content.

Don’t

  • hide crucial information
  • include other components inside a Details area
  • use a dark theme callout on a light theme.

With icon

Setting the iconBefore prop to true will render the InfoIcon before the label.

<Details label="Details label" iconBefore>
	<Text as="p">
		This is a small paragraph of text that is supplementary to the main page
		content.
	</Text>
</Details>

On Body Alt

If the Details component is placed on a page with bodyAlt background, set the onBodyAlt prop to true. This ensures the correct shade background token is used by the component.

<Box background="bodyAlt" padding={1.5}>
	<Details label="Details label" iconBefore onBodyAlt>
		<Text as="p">
			This is a small paragraph of text that is supplementary to the main page
			content.
		</Text>
	</Details>
</Box>
  • Accordion An accordion lets users show and hide sections of related content.
  • Tabs Tabs are used to categorise content into seperate views. A user can navigate between each section of content, displaying one section at a time.