Skip to content

Remove Button Plugin

The remove-button plugin adds a small "x" button to each selected item, allowing users to remove individual selections with a single click.

Usage

Behavior

  • A small "x" icon appears on the right side of each selected item (left side in RTL mode)
  • Clicking the button removes that single item from the selection
  • The removed option becomes available again in the dropdown
  • The ds:item:remove event fires when an item is removed via the button

Combining with Other Plugins

The remove button works well alongside other plugins:

Styling

The remove button uses the .ds-item-remove CSS class. Customize its appearance:

css
.dot-select .ds-item-remove {
  font-size: 14px;
  color: #94a3b8;
  margin-left: 4px;
  cursor: pointer;
}

.dot-select .ds-item-remove:hover {
  color: #ef4444;
}

Accessibility

The remove button includes an aria-label attribute with the localized "Remove" text. This label is set by the removeItem key in the active locale.

TIP

For single-select elements, use data-allow-clear="true" instead of the remove-button plugin. The remove button is designed for multiple-select scenarios where individual items need to be removed.

MIT Licensed