Details

Details is a styled component to enhance the native behaviors of the <details> element.

React
readyNot reviewed for a11y
Rails
readyNot reviewed for a11y

The details component can reveal additional information by using a button to toggle between hidden and visible. It includes a summary followed by the content that's hidden or visible.

By default, the information is hidden. When triggered, it expands and displays the information.

React examples

Default

See DetailsToggle DetailsThis is some content

Details component open by default

See DetailsToggle DetailsThis is some content

With a callback for clicking outside the component

See DetailsToggle DetailsThis is some content

Close the Details component when clicking outside of it

See DetailsSee DetailsThis is some content

Props

Details

NameRequiredDescription
sx
SystemStyleObject

Details.Summary

NameRequiredDescription
as
React.ElementType<React.PropsWithChildren<any>>
HTML element to render summary as.
children
React.ReactNode
sx
SystemStyleObject