Spoiler
Hide long sections of content under a spoiler
Import
Source
Docs
Package
Usage
Use Spoiler
to hide long section of content.
Set maxHeight
prop to control point at which content will be hidden under spoiler and show/hide control appears.
If the content height is less than maxHeight
, the spoiler will just render children.
hideLabel
and showLabel
props are required – they are used as spoiler toggle button label in corresponding state.
We Butter the Bread with Butter was founded in 2007 by Marcel Neumann, who was originally guitarist for Martin Kesici's band, and Tobias Schultka. The band was originally meant as a joke, but progressed into being a more serious musical duo. The name for the band has no particular meaning, although its origins were suggested from when the two original members were driving in a car operated by Marcel Neumann and an accident almost occurred. Neumann found Schultka "so funny that he briefly lost control of the vehicle." Many of their songs from this point were covers of German folk tales and nursery rhymes.
Control expanded state
To control expanded state use expanded
and onExpandedChange
props. Note that
expanded
prop does not have any effect on spoiler visuals if the content height
is less than given maxHeight
.
Subscribe to expanded state changes
Use onExpandedChange
to subscribe to expanded state changes:
Transition duration
Control transition duration by setting transitionDuration
prop (transition-duration CSS property in ms).
To disable animations, set transitionDuration={0}
:
We Butter the Bread with Butter was founded in 2007 by Marcel Neumann, who was originally guitarist for Martin Kesici's band, and Tobias Schultka. The band was originally meant as a joke, but progressed into being a more serious musical duo. The name for the band has no particular meaning, although its origins were suggested from when the two original members were driving in a car operated by Marcel Neumann and an accident almost occurred. Neumann found Schultka "so funny that he briefly lost control of the vehicle." Many of their songs from this point were covers of German folk tales and nursery rhymes.