Skip to main content Sidebar
Skip to table of contents

    Option

    <pc-option> 0.5.1 experimental

    Options define the selectable items within various form controls such as a select.

    Additional demonstrations can be found in the select demos.

    Properties#

    NameDescriptionReflectsDefault
    valueThe option’s value. When selected, the containing form control will receive this value. The value must be unique from other options in the same group. Values must not contain spaces, as spaces are used as delimiters when listing multiple values.
    Type: string
    ""
    disabledDisables the option, preventing selection.
    Type: boolean
    false
    updateComplete A read‐only promise that resolves when the component has finished updating.

    Learn more about attributes and properties.

    Slots#

    NameDescription
    (default)The option’s label.
    prefixUsed to prepend an icon or similar element to the option.
    suffixUsed to append an icon or similar element to the option.

    Learn more about using slots.

    Methods#

    NameDescriptionArguments
    getTextLabel()Returns a plain text label based on the option’s content.

    Learn more about methods.

    Parts#

    NameDescription
    checked-iconThe checked icon, a <pc-icon> element.
    baseThe component’s base wrapper.
    labelThe option’s label.
    prefixThe container that wraps the prefix.
    suffixThe container that wraps the suffix.

    Learn more about customising CSS parts.

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

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

    import "placer-toolkit/dist/components/option/option.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!