Details
Details provide collapsible content sections that can be expanded or hidden by the reader. Useful for explanations, optional information, or progressive disclosure. Collapsing behavior can be disabled to create a static block.
Properties
title
string
optional
The title shown in the summary section.
icon
string
optional
The icon displayed next to the title. Uses Scalar icon format. Defaults to line/arrow-chevron-right
.
interactivity
string
optional
Controls whether the component is interactive (details
) or static (div
).
Use "none"
to render a non-collapsible container.
open
boolean
optional
If true
, the section starts expanded. The default behavior is for the section
to start in a collapsed state.
Examples
Basic Collapsible Section
More Info
Here is some additional content.
<scalar-detail title="More Info">
Here is some additional content.
</scalar-detail>
More Info
Here is some additional content.
:::scalar-detail{title="More Info"}
Here is some additional content.
:::
Open by Default
Default Open
The section is open by default.
<scalar-detail title="Default Open" open>
The section is open by default.
</scalar-detail>
Default Open
The section is open by default.
:::scalar-detail{title="Default Open" open='true'}
The section is open by default.
:::
With Custom Icon
Custom Icon
Using a custom icon.
<scalar-detail title="Custom Icon" icon="airplane">
Using a custom icon.
</scalar-detail>
Custom Icon
Using a custom icon.
:::scalar-detail{title="Custom Icon" icon="airplane"}
Using a custom icon.
:::
Non-interactive Block
These do not collapse when clicked.
<scalar-detail title="Non-Interactive">
These do not collapse when clicked.
</scalar-detail>
These do not collapse when clicked.
:::scalar-detail{title="Non-Interactive" interactivity="none" }
These do not collapse when clicked.
:::
Nested
Nested, Outer
Outer details content.
Nested, Inner
Inner details content.
<scalar-detail title="Nested, Outer" >
Outer details content.
<scalar-detail title="Nested, Inner" >
Inner details content.
</scalar-detail>
</scalar-detail>
Nested, Outer
With directives, the parent must have at least 1 more :
than the elements it wraps.
Non-Interactive
Inner details content.
::::scalar-detail{title="Nested, Outer" }
With directives, the parent must have at least 1 more `:` than the elements it wraps.
:::scalar-detail{title="Non-Interactive" }
Inner details content.
:::
::::