Details
Details show a brief summary and expand to show additional content.
<pc-details summary="Toggle me">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</pc-details>
Demos
Disabled
Use the disabled
attribute to disable the details component.
Customise the summary icon
Use the expand-icon
and collapse-icon
slots to change the expand and collapse icons, respectively. To disable the animation, override the rotate
property on the summary-icon
part as shown below.
Group details
Details are designed to function independently, but you can simulate a group or “accordion” where only one is shown at a time by listening for the pc-show
event.
Properties
Name | Description | Reflects | Default |
---|---|---|---|
dependencies | object | { "pc-icon": PcIcon } | |
details | HTMLDetailsElement | - | |
header | HTMLElement | - | |
body | HTMLElement | - | |
expandIconSlot | HTMLSlotElement | - | |
detailsObserver | MutationObserver | - | |
disabled | boolean | false | |
open | boolean | false | |
summary | string | undefined | - | |
updateComplete | A read‐only promise that resolves when the component has finished updating. | - |
Learn more about attributes and properties.
Methods
Name | Description | Arguments |
---|---|---|
handleOpenChange() | - | |
show() | - | |
hide() | - |
Learn more about methods.
Importing
If you’re using the autoloader or the standard loader, you can ignore this section. If you’re cherry picking, you can use any of the following snippets to import this component.
To import this component from the CDN with a script tag, copy this snippet and paste it in your HTML.
<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@0.5.1/dist/components/details/details.js"></script>
To import this component from the CDN using a JavaScript import, copy this snippet and paste it in your JavaScript:
import "https://cdn.jsdelivr.net/npm/placer-toolkit@0.5.1/dist/components/details/details.js";
To import this component with a bundler using a JavaScript import, copy this snippet and paste it in your JavaScript:
import "placer-toolkit/dist/components/details/details.js";