0.1.0-rc.2

Disclosure

Disclosures progressively reveal content behind a trigger, such as FAQs, filter panels, or advanced settings that most users can skip.

Try it

Delivered in 3–5 business days.

Usage

Use RuiDisclosureTrigger and RuiDisclosurePanel inside RuiDisclosure. Group related disclosures with RuiDisclosureGroup when only one should be open.

import {
  RuiDisclosure,
  RuiDisclosureTrigger,
  RuiDisclosurePanel,
  RuiDisclosureIcon,
} from '@ecopages/radiant-ui/disclosure';
 
<RuiDisclosure>
  <RuiDisclosureTrigger>
  Shipping details
  <RuiDisclosureIcon />
  </RuiDisclosureTrigger>
  <RuiDisclosurePanel>Delivered in 3–5 business days.</RuiDisclosurePanel>
</RuiDisclosure>

Accordion groups

Wrap multiple disclosures in RuiDisclosureGroup with multiple=\{false} for accordion behavior.

Animated panels

Enable animated for height transitions. Verify content remains readable during the animation.

Theming

Disclosure surfaces map to semantic surface roles, never Tailwind palette steps:

PartCSS roles
Trigger (rui-disclosure__trigger)on-background; hover / focus surface, --focus-ring
Panel (rui-disclosure__panel)on-surface
Group (rui-disclosure-group)background, border, rounded-container; panel header surface

Override roles at the theme layer, not in component CSS.

API

Disclosure provides two custom elements: <rui-disclosure> (show/hide) and <rui-disclosure-group> (accordion). Compose the view helpers to render triggers and panels, or mark up data-disclosure-trigger / data-disclosure-panel elements directly.

Attributes (<rui-disclosure>)

AttributeTypeDefaultDescription
openbooleanfalseWhether the disclosure content starts expanded.
valuestring''Optional value used when coordinating disclosures inside a group.
animatedbooleanfalseAnimate panel height; also enabled inside an animated group.

Attributes (<rui-disclosure-group>)

AttributeTypeDefaultDescription
multiplebooleanfalseAllow more than one disclosure open (exclusive by default).
animatedbooleanfalseAnimate panel height for child disclosures.

Slots

SlotDescription
triggerDisclosure button (RuiDisclosureTrigger).
(default)Panel content (RuiDisclosurePanel). For <rui-disclosure-group>, rui-disclosure children.

Events

EventDetailDescription
rui-disclosure-toggle{ value, open }Emitted on every trigger activation; groups listen for exclusive behavior.

View helpers

ComponentRenders
RuiDisclosure<rui-disclosure> (adds trigger + panel when composed)
RuiDisclosureGroup<rui-disclosure-group>
RuiDisclosureTriggerTrigger button
RuiDisclosureIconIndicator (chevron / plus)
RuiDisclosurePanelPanel region

CSS classes

Public BEM classes on the composed light-DOM surface (documented via @cssclass):

ClassDescription
.rui-disclosureRoot wrapper around trigger and panel slots.
.rui-disclosure__triggerTrigger button; reflects aria-expanded.
.rui-disclosure__trigger--icon-endLayout when iconPosition="end".
.rui-disclosure__iconIndicator wrapper (decorative, aria-hidden).
.rui-disclosure__icon--chevronRotates 90° when open.
.rui-disclosure__icon--plusToggles between + and ×.
.rui-disclosure__labelTrigger text.
.rui-disclosure__panelPanel content region.
.rui-disclosure__panel-innerPanel padding wrapper (drives the height animation).
.rui-disclosure-groupGroup surface (bordered card around stacked disclosures).

Theme roles

PartCSS variables consumed
Trigger--on-background, --surface (hover), --focus-ring, --space-control-*
Panel--on-surface
Group--background, --border, --surface

Accessibility

  • Triggers expose aria-expanded reflecting panel visibility.
  • Panel content is associated with its trigger via aria-controls.
  • Keyboard users activate disclosures with Enter or Space on the trigger.