Collapsible

Shows and hides a section. Disclosure is the styled version: a 36 px trigger row with a chevron, a 13 px title and an optional muted count, and its content indented 32 px under the title. Accordion is several of them working together. The content grows to its height as it opens.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { Disclosure, Accordion, AccordionItem, Collapsible, CollapsibleTrigger, CollapsibleContent } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Props

title
meta
children
disabled

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoUse Disclosure for one section the reader opens on demand, like a matter's billing details, so it sits closed on a 36 px row until needed.
DoUse Accordion for a stack of sections where one open at a time keeps the panel short. Set multiple when a lawyer needs to compare two.
DoPut a short muted note in meta, like "4 fields", so the reader knows what is inside before opening it.
DoUse bare Collapsible with CollapsibleTrigger and render only when the trigger is your own control, like a Show more link under a list.
Don'tHide a required field inside a closed section. Its error would be out of sight when the form fails to save.

Props

Collapsible and Disclosure take ui-sdk's Collapsible options: open, defaultOpen, onOpenChange, disabled and controller. CollapsibleTrigger takes render. Accordion takes ui-sdk's Accordion options: value, defaultValue, onValueChange, multiple, collapsible, disabled and keepMounted; AccordionItem takes value and disabled.

Disclosure

PropTypeDefaultDescription
title *ReactNode—The 13 px title on the 36 px trigger row.
metaReactNode—A short muted note on the right of the trigger, like "4 fields".
childrenReactNode—What opens, 32 px in, under the title.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Accordion

PropTypeDefaultDescription
childrenReactNode—What it shows inside.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

AccordionItem

PropTypeDefaultDescription
title *ReactNode—The 13 px title on the 36 px header row.
metaReactNode—A short muted note on the right of the header, like "3 fields".
childrenReactNode—What opens, 32 px in, under the title.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Collapsible

No props of its own.

CollapsibleTrigger

No props of its own.

CollapsibleContent

PropTypeDefaultDescription
childrenReactNode—What it shows inside.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Code

What the playground shows, ready to copy.

import { Disclosure } from "@leap-crm/design-system";

<Disclosure
  title="Matter details"
  meta="4 fields"
>
  Matter type, responsible staff, practice area and billing.
</Disclosure>

Your own trigger

Compose Collapsible, CollapsibleTrigger and CollapsibleContent when the trigger isn't a row, like a Show more button. Pass the control to render.

Jane Citizen is buying a house in Paddington with her partner.

Several together: Accordion

Accordion stacks disclosures on dividers and coordinates them: opening one closes the other, and the arrow keys move between headers. Each header is a heading, so screen reader users can jump between sections.

Conveyancing · Purchase · Ada Hartley responsible

Accordion, several open

multiple lets several items stay open together.

Conveyancing · Purchase · Ada Hartley responsible

Fixed fee $2,200, disbursements at cost.

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
EnterSpaceToggle the panel and keep focus on the trigger.
TabMoves from an open trigger into its panel, and skips a closed panel.