## Spoiler Use the Spoiler component to hide long sections of content. Category: Data Display ### Simple Example Use Spoiler to hide long sections of content. Pass `maxHeight` prop to control the point at which content will be hidden under the spoiler and control to show/hide extra appears. If content height is less than `maxHeight`, spoiler will just render children. Props `hideLabel` and `showLabel` are required - they are used as spoiler toggle button label in corresponding state. ```python import dash_mantine_components as dmc # very long string text = "" component = dmc.Spoiler( showLabel="Show more", hideLabel="Hide", maxHeight=50, children=[dmc.Text(text)], ) ``` ### Styles API This component supports Styles API. With Styles API, you can customize styles of any inner element. See the Styling and Theming sections of these docs for more information. | Name | Static selector | Description | |:--------|:-------------------------|:-----------------------------------------------| | root | .mantine-Spoiler-root | Root element | | content | .mantine-Spoiler-content | Wraps content to set max-height and transition | | control | .mantine-Spoiler-control | Show/hide content control | ### Keyword Arguments #### Spoiler - children (a list of or a singular dash component, string or number; optional): Content. - id (string; optional): Unique ID to identify this component in Dash callbacks. - aria-* (string; optional): Wild card aria attributes. - attributes (boolean | number | string | dict | list; optional): Passes attributes to inner elements of a component. See Styles API docs. - className (string; optional): Class added to the root element, if applicable. - classNames (dict; optional): Adds custom CSS class names to inner elements of a component. See Styles API docs. - darkHidden (boolean; optional): Determines whether component should be hidden in dark color scheme with `display: none`. - data-* (string; optional): Wild card data attributes. - expanded (boolean; default False): Controlled expanded state value. - hiddenFrom (string; optional): Breakpoint above which the component is hidden with `display: none`. - hideLabel (a list of or a singular dash component, string or number; required): Label for close spoiler action. - initialState (boolean; optional): Initial spoiler state, True to wrap content in spoiler, False to show content without spoiler, opened state is updated on mount. - lightHidden (boolean; optional): Determines whether component should be hidden in light color scheme with `display: none`. - loading_state (dict; optional): Object that holds the loading state object coming from dash-renderer. For use with dash<3. `loading_state` is a dict with keys: - maxHeight (number; optional): Maximum height of the visible content, when this point is reached spoiler appears, `100` by default. - mod (string | dict | list of string | dicts; optional): Element modifiers transformed into `data-` attributes. For example: "xl" or {"data-size": "xl"}. Can also be a list of strings or dicts for multiple modifiers. Falsy values are removed. - showLabel (a list of or a singular dash component, string or number; required): Label for open spoiler action. - styles (boolean | number | string | dict | list; optional): Adds inline styles directly to inner elements of a component. See Styles API docs. - tabIndex (number; optional): tab-index. - transitionDuration (number; optional): Spoiler reveal transition duration in ms, set 0 or None to turn off animation, `200` by default. - variant (string; optional): variant. - visibleFrom (string; optional): Breakpoint below which the component is hidden with `display: none`.