Skip to main content Design tokens Components Style utilities
Skip to table of contents

    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>
    Code

    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

    NameDescriptionReflectsDefault
    dependencies object{ "pc-icon": PcIcon }
    details HTMLDetailsElement-
    header HTMLElement-
    body HTMLElement-
    expandIconSlot HTMLSlotElement-
    detailsObserver MutationObserver-
    disabled booleanfalse
    open booleanfalse
    summary string | undefined-
    updateComplete A read‐only promise that resolves when the component has finished updating. -

    Learn more about attributes and properties.

    Methods

    NameDescriptionArguments
    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.

    ScriptImportBundler

    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";