Preview Only: These components are for reference only. Continue using Orbiter in production until further notice.

Disclosure

The disclosure component is used to put long sections of information under a block that users can expand or collapse.

Anatomy

Composed Components

A Disclosure uses the following components.

Usage

Disabled

A disclosure can be disabled.

Variants

A disclosure has multiple variants.

Standalone - Used when the disclosure is not inside a container.

Inline - Used when placing a disclosure inside a container.

Icon

A disclosure can contain an icon.

Description

A disclosure can contain a description.

Controlled

A disclosure can handle its expanded state in controlled mode.

Custom Header

A disclosure can have a custom header. To accomplish this, do not use DisclosureHeader and use the Button component with slot="trigger" instead. Using React Aria's Button component will also work.

Props

Disclosure

variant?
style?

The inline style for the element. A function may be provided to compute the style based on component state.

children?

The children of the component. A function may be provided to alter the children based on component state.

isDisabled?

Whether the disclosure is disabled.

isExpanded?

Whether the disclosure is expanded (controlled).

defaultExpanded?

Whether the disclosure is expanded by default (uncontrolled).

id?

An id for the disclosure when used within a DisclosureGroup, matching the id used in expandedKeys.

className?

The CSS className for the element. A function may be provided to compute the class based on component state.

Disclosure Header

buttonProps?

The props for the button that triggers the disclosure.

size?

The Typography Type Scale to use.

Defaults to md.
style?
level?
className?

Disclosure Panel

style?

The inline style for the element. A function may be provided to compute the style based on component state.

children

The children of the component.

className?

The CSS className for the element. A function may be provided to compute the class based on component state.

Progressive Enhancement

Our Disclosure component uses experimental CSS features like:

  • interpolate-size: allow-keywords: Enables fluid transitions between dynamic sizes.

  • transition-behavior: allow-discrete: Allows transitions for properties like content-visibility.

These features enhance animations where supported. In browsers without support, the component remains fully usable without animations, maintaining progressive enhancement.

Migration Notes

Coming from Orbiter, you should be aware of the following changes:

  • Disclosure now has two children components called DisclosureHeader and DisclosurePanel.
  • DisclosurePanel is optional and most likely wouldn't be used for Orbiter. A custom header can be used by using a Button component inside Disclosure.
  • defaultOpen is renamed to defaultExpanded.
  • open is renamed to isExpanded.
  • onOpenChange is renamed to onExpandedChange.