Disclosure

Maintainer:
Raubzeug
GitHub
size
disabled
arrowPosition
summary
children
import {Disclosure} from '@gravity-ui/uikit';

Disclosure is a collapsible component that allows to display and hide its nested content.

Controlling expansion state

You can control the expansion state using the expanded and onUpdate properties.

Controlled component example:

Content

Size

Use the size property to control the Disclosure size. The default size is m.

Content
Content
Content

Arrow Position

start: Arrow is positioned at the start of the header (used by default).

end: Arrow is positioned at the end of the header.

Content
Content

Custom content

Use Disclosure.Summary component to create a custom header and Disclosure.Details to fulfill custom content.

Custom details
More custom details
Custom Details

Disabled state

Disclosure can be disabled using the disabled property.

Content

Properties

Disclosure

NameDescriptionTypeDefault
sizeComponent size"m" "l" "xl""m"
classNameCSS class name of the root elementstring
disabledDisabled statebooleanfalse
defaultExpandedDefault opening statebooleanfalse
expandedControlled opening stateboolean
arrowPositionControl position"start" "end""start"
summaryContent summaryReact.ReactNode
keepMountedKeep content in DOM even when collapsedbooleantrue
onUpdateCallback is fired when the expand/collapse state is changed.(expanded: boolean) => void
onSummaryKeyDownCallback fires on keyboard events when summary is focused.(e: React.KeyboardEvent<HTMLButtonElement>) => void
childrenContentReact.ReactNode
qaTest identifierstring

Disclosure.Summary

NameDescriptionTypeDefault
childrenRender function(props, defaultSummary) => React.ReactElement
qaTest identifierstringdisclosure-summary

Disclosure.Details

NameDescriptionTypeDefault
childrenContentReact.ReactNode
qaTest identifierstringdisclosure-details

CSS API

NameDescription
--g-disclosure-text-colorText color for the content summary
--g-disclosure-text-color-disabledText color for the content summary in disabled state