Introducing Motion-Primitives Pro - Advanced components and templates to help you build a website that stands out.

Disclosure

The Disclosure component allows users to toggle the visibility of content, either collapsed or expanded.

Examples

Basic Disclosure

Disclosure with custom animation

Image from Les others studio

Les others studio - Que la montagne est belle ⛰

Installation

npx shadcn add "https://motion-primitives.com/c/disclosure.json"

Component API

Disclosure

PropTypeDefaultDescription
openbooleanfalseControls the visibility of the content.
onOpenChange(open: boolean) => voidCallback function to handle changes in the open state.
childrenReactNodeThe content to be toggled, typically includes DisclosureTrigger and DisclosureContent.
classNamestringAdditional CSS classes for the container.
variants{ expanded: Variant; collapsed: Variant }Custom animation variants for expanded and collapsed states.
transitionTransitionCustom transition settings for the motion animations.

DisclosureTrigger

PropTypeDefaultDescription
childrenReactNodeThe trigger element that will toggle the disclosure.
classNamestringAdditional CSS classes for the trigger element.

DisclosureContent

PropTypeDefaultDescription
childrenReactNodeThe content that will be shown or hidden by the disclosure.
classNamestringAdditional CSS classes for the content container.