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

    Tag

    Tags are used as labels to organise things or to indicate a selection.

    <pc-tag appearance="primary">Primary</pc-tag>
    <pc-tag appearance="success">Success</pc-tag>
    <pc-tag appearance="neutral">Neutral</pc-tag>
    <pc-tag appearance="warning">Warning</pc-tag>
    <pc-tag appearance="danger">Danger</pc-tag>
    Code

    Sizes

    Use the size attribute to change the tag’s size.

    Outlined

    Use the outlined attribute to draw outlined tags with transparent backgrounds.

    Pill

    Use the pill attribute to give tags a pill‐shaped look.

    Removable

    Use the removable attribute to add a remove button to the tag.

    Properties

    NameDescriptionReflectsDefault
    appearanceThe tag’s appearance. "primary" | "success" | "neutral" | "warning" | "danger""neutral"
    sizeThe tag’s size. "small" | "medium" | "large""medium"
    outlinedDraws an outlined tag. booleanfalse
    pillDraws a pill‐style tag. booleanfalse
    removableAdds a remove button to the tag. booleanfalse
    updateComplete A read‐only promise that resolves when the component has finished updating. -

    Learn more about attributes and properties.

    Slots

    NameDescription
    (default)The tag’s content.

    Learn more about using slots.

    Events

    NameDescriptionEvent detail
    pc-removeEmitted when the remove button is pressed.-

    Learn more about events.

    Parts

    NameDescription
    baseThe tag’s base wrapper.
    contentThe tag’s content.
    remove-buttonThe tag’s remove button, a <pc-icon-button>.
    remove-button__baseThe remove button’s base part.

    Learn more about customising CSS parts.

    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/tag/tag.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/tag/tag.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/tag/tag.js";

    Dependencies

    This component automatically imports these components: