Details
Creates a collapsible content area that can be expanded or collapsed by users. Use with Summary to provide expandable sections for additional information or settings.
Anchor to propertiesProperties
- Anchor to defaultOpendefaultOpenbooleanDefault: false
Indicates whether the element should be open by default.
This reflects to the
open
attribute.- string
A unique identifier for the element.
- Anchor to openopenbooleanDefault: false
Whether the element is open.
This does not reflect to any attribute.
- Anchor to toggleTransitiontoggleTransition'none' | 'auto'Default: 'auto'
Sets the transition between the two states.
Was this section helpful?
Anchor to summarySummary
Provides a clickable label for collapsible Details content. Use to create clear, accessible disclosure controls that show or hide additional information.
- string
A unique identifier for the element.
Was this section helpful?
Anchor to eventsEvents
- Anchor to aftertoggleaftertoggle((event: CallbackEventListener<typeof tagName>) => void) | null
Callback fired when the element state changes after any animations have finished.
- If the element transitioned from hidden to showing, the
property will be set to
closed
and theproperty will be set to
open
. - If the element transitioned from showing to hidden, the
property will be set to
open
and thewill be
closed
.
- If the element transitioned from hidden to showing, the
- Anchor to toggletoggle((event: CallbackEventListener<typeof tagName>) => void) | null
Callback straight after the element state changes.
- If the element is transitioning from hidden to showing, the
property will be set to
closed
and theproperty will be set to
open
. - If the element is transitioning from showing to hidden, then
property will be set to
open
and thewill be
closed
.
- If the element is transitioning from hidden to showing, the
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Was this section helpful?
Code
<s-details defaultOpen>
<s-summary>Pickup instructions</s-summary>
<s-text>
Curbside pickup is at the back of the warehouse. Park in a stall and follow the signs.
</s-text>
</s-details>
Examples
Code
Default
<s-details defaultOpen> <s-summary>Pickup instructions</s-summary> <s-text> Curbside pickup is at the back of the warehouse. Park in a stall and follow the signs. </s-text> </s-details>
Preview
