Component API

<dropdown-button>

Open live example

A primary-styled button with a label and chevron that opens an anchored
menu of actions — essentially form-select minus "current value"
semantics: a menu, not a select. Use for a set of mutually exclusive
next-step actions (e.g. a failed task's Retry / Close / Backlog).

Install

import "@f-ewald/components/dropdown-button.js";

Usage

<dropdown-button label="Resolve…"></dropdown-button>
<script type="module">
  const dropdown = document.querySelector("dropdown-button");
  dropdown.options = [
    { value: "retry", label: "Retry" },
    { value: "close", label: "Close" },
    { value: "backlog", label: "Backlog" },
  ];
  dropdown.addEventListener("select", (e) => console.log(e.detail.value));
</script>

Attributes / properties

PropertyAttributeTypeDefaultDescription
labellabelstring""The trigger button's label.
optionsJS property onlyDropdownOption[][]The menu's actions.
disableddisabledbooleanfalseDisables the trigger, preventing the menu from opening.

Events

EventDescription
selectFired with { value: string } when a menu item is picked.

Slots

None.

CSS custom properties

Custom property
--ui-border
--ui-focus-ring
--ui-font
--ui-font-size-sm
--ui-font-weight-medium
--ui-line-height-tight
--ui-on-accent
--ui-primary
--ui-primary-hover
--ui-radius-sm
--ui-shadow
--ui-surface
--ui-surface-muted
--ui-text