Skip to main content Sidebar
On this page
Skip to table of contents

Details

<pc-details> 0.5.1 experimental

Details show a brief summary and expand to show additional content.

<pc-details summary="Toggle me">
    This section contains additional details that are hidden by default. Use details to progressively disclose content that isn’t required immediately, such as explanations, hints or secondary settings.
</pc-details>
Code Edit

Demos

Variants

Use the variant attribute to change the details’ variant.

Edit

Disabled

Use the disabled attribute to prevent the details from expanding.

Edit

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.

Edit

HTML in summary

To use HTML in the summary, use the summary slot. Links and other interactive elements will still retain their behaviour.

Edit

RTL language support

The details component automatically adapts to RTL languages with the lang and dir attributes.

Edit

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.

Edit

Properties

NameDescriptionReflectsDefault
openIndicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you can use the show() or hide() methods and this attribute will reflect the details’ open state.
Type: boolean
false
summaryThe summary to show in the header. If you need to display HTML, use the summary slot instead.
Type: string | undefined
variantThe details’ variant.
Type: "filled" | "outlined" | "plain"
"outlined"
disabledDisables the details so it can’t be toggled.
Type: boolean
false
updateComplete A read‐only promise that resolves when the component has finished updating.

Learn more about customising animations.

Slots

NameDescription
(default)The details’ main content.
summaryThe details’ summary. Alternatively, you can use the summary attribute.
expand-iconAn optional expand icon to use instead of the default. Works best with <pc-icon>.
collapse-iconAn optional collapse icon to use instead of the default. Works best with <pc-icon>.

Learn more about using slots.

Methods

NameDescriptionArguments
show()Shows the details.
hide()Hides the details.

Learn more about methods.

Events

NameDescriptionEvent detail
pc-showEmitted when the details opens.
pc-after-showEmitted after the details opens and all animations are complete.
pc-hideEmitted when the details closes.
pc-after-hideEmitted after the details closes and all animations are complete.

Learn more about events.

Parts

NameDescription
baseThe component’s base wrapper.
headerThe header that wraps both the summary and the expand/collapse icon.
summaryThe container that wraps the summary.
summary-iconThe container that wraps the expand/collapse icons.
bodyThe container of the details’ content.
contentThe details’ content.

Learn more about customising CSS parts.

Animations

NameDescription
details.showThe animation to use when showing details. You can use both height: auto and block-size: auto with this animation.
details.hideThe animation to use when hiding details. You can use height: auto and block-size: auto with this animation.

Learn more about customising animations.

Importing

If you’re using the autoloader or the standard loader, you can skip this section. But if you’re cherry picking, you can use any of the following snippets to import this component.

CDN (script tag)CDN (import)npm (import)

To manually import this component from the CDN, copy this code snippet and paste it in your HTML.

<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/details/details.js"></script>

To manually import this component from the CDN, copy this code snippet and paste it in your JavaScript file.

import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/details/details.js";

To manually import this component from npm, copy this code snippet and paste it in your JavaScript file.

import "placer-toolkit/dist/components/details/details.js";

Dependencies

This component automatically imports these components:

We’d love to hear from you. Please reach out to us with any questions or enquiries you may have.

You can contact us via e‐mail at placer.coc.reports+contact@gmail.com.

We look forward to hearing from you!

Got it!
Dangerous lands

Whoa! You’ve wandered into the dangerous lands of Placer Toolkit. Version 0 is out of date and doesn’t meet EU privacy standards, including GDPR.

Want the latest powers, security and compliance? Stick with the current version of Placer Toolkit!

Yikes! Power up!

Our site is 100 % cookie‐free! We value your privacy, which is why we don’t store any cookies or personal information related to you.

Your browser history is safe from crumbs, and your data is protected, aligning with modern privacy standards like the GDPR. Enjoy your visit without a single digital cookie in sight! 🍪🚫

View our Privacy Policy for more information.

Got it!