Layout

Disclosure

Single-section expand/collapse — Surface trigger by default, Panel as a height motion shell.

Base UI


Disclosure wraps Base UI Collapsible for one expandable section. Compose Disclosure.Trigger and Disclosure.Panel under the root. Root open, defaultOpen, and onOpenChange come from Base UI.

The default Trigger is a Surface host (hoverColor defaults to 2) with chevron chrome at the logical end. Pass Surface props on Trigger for border, color, radius, and padding. Panel is a height motion shell only — pad children yourself with Stack. For a multi-item FAQ or settings list, use Accordion instead.

Keyboard and aria behavior stay upstream. You compose the label, panel content, and surrounding chrome in JSX.


Anatomy

Import the component and assemble its parts:

import { Disclosure } from '@viraui/react';

<Disclosure>
  <Disclosure.Trigger />
  <Disclosure.Panel />
</Disclosure>

When to use

  • One expandable block (shipping details, advanced options, order summary)
  • A Surface-styled row that reveals more copy or controls underneath
  • A custom host (render) that still toggles a collapsible panel

When not to use

  • Several related sections in one list → Accordion
  • Persistent peer views in the same region → Tabs
  • Content that should always stay visible → plain Stack / Surface
  • Full silhouette morph between two control faces → Interpolator

Common examples

Surface trigger

Default Trigger is Surface with end chevron chrome. Panel has no content padding — wrap children in Stack (or your own layout) when the copy needs inset.

Icon pair

Pass restingIcon / openIcon for a ToggleButton-style pair. Turn on interpolateIcons for a short crossfade and rotate; leave it off for an instant swap. Omit both icons to keep the built-in chevrons.

Custom trigger

Pass Trigger render when a Button (or other host) should own the chrome. Surface defaults do not apply on that path — the consumer host replaces the whole compose.

Controlled open

Own open / onOpenChange when another control, URL state, or parent form must drive the panel. The demo seeds a secondary Button that toggles the same state from outside the Trigger.

Ask your agent

Add a shipping details disclosure under the checkout summary — closed by default, Surface-styled trigger with radius, and a short muted paragraph inside the panel with normal padding.

  • Accordion — multi-item expand/collapse lists
  • Surface — default Trigger host chrome
  • Stack — root host and Panel child layout
  • ToggleButton — icon-pair / interpolateIcons naming sibling
  • Interpolator — full control-face morph instead of icon swap

Last updated on

On this page