Details
A disclosure component
Usage ¶
The name attribute enables multiple <Details>
elements to be connected, with only one open at a time. The <Details>
elements don't even have to be adjacent to one another in the source to be part of the same group.
Events ¶
The Details
component doesn't emit or listen to any events, but the native <details>
element inside do.
In addition to the usual events supported by HTML elements, the <details>
element supports the toggle
event,
which is dispatched to the <details>
element whenever its state changes between open and closed.
The toggle
event is sent after the state is changed, although if the state changes multiple times before the
browser can dispatch the event, the events are coalesced so that only one is sent.
details.addEventListener("toggle", (event) => {
if (details.open) {
/* the element was toggled open */
} else {
/* the element was toggled closed */
}
});
Component arguments ¶
Details
¶
No arguments.
Details.Summary
¶
No arguments.
Details.Panel
¶
No arguments.
Components ¶
Component |
File |
Source |
---|---|---|
Details |
details/index.jinja |
|
Details.Summary |
details/summary.jinja |
|
Details.Panel |
details/panel.jinja |
|
details/details.css |