Creates a WidthSelect component inside the given element.
The host element that will contain the width picker.
Optional display and behaviour configuration.
ProtectedhostProtectedconfigProtectedselectedProtectedtriggerProtectedtriggerProtected OptionaltriggerProtectedmenuGets the currently selected width value.
Sets the currently selected width value.
Releases DOM/event resources owned by the control.
Sets the available width options and optionally selects a width.
An array of widths.
OptionalselectedWidth: numberThe width to select. Defaults to the first width in the array.
Protected ReadonlyonHandles the click event on the trigger button. Toggles the open/closed state of the dropdown menu.
Protected ReadonlyonHandles the click event on the document. Closes the dropdown menu if the click is outside the host element.
The click event.
Protected ReadonlyonHandles the click event on an option. Selects the clicked width and closes the dropdown menu.
The click event.
ProtectedrebuildReplaces the current option list with a new set of widths.
The pixel-width values to render.
ProtectedbuildBuilds a single option button containing an SVG stroke-width preview.
The pixel width value for this option.
The constructed option button element.
ProtectedcreateCreates an SVG element visualising a horizontal line at the given stroke width.
The stroke width in pixels.
The SVG element.
ProtectedselectUpdates the internal selection state, syncs the trigger and option list, and optionally emits 'widthchange'.
The new width value to select.
Whether to dispatch the change event. Defaults to true.
ProtectedsyncUpdates the trigger button's swatch and optional label to reflect the current width.
ProtectedsyncToggles the selected CSS class and aria-selected attribute on all width option buttons.
ProtectedopenAdds the open CSS class and updates aria-expanded on the trigger button.
ProtectedcloseRemoves the open CSS class and updates aria-expanded on the trigger button.
A dropdown component for selecting line widths. It displays a list of predefined widths and allows the user to select one. The selected width is reflected in the trigger button and can be accessed via the
valueproperty. The component emits a 'widthchange' event when the selected width changes.