Filter Pill

New
Source

Filter control with selectable options in a popover.

Controlled selection, trailing slots and opened require @dialpad/dialtone 10.12.0 or later.

Usage

Pass an options array when the component mounts and bind v-model:selected to manage selection in your application. Start with [] while loading options.

If you already use v-model, keep the same { name, active? }[] array and update each item’s active value in place. Don’t combine the two selection APIs.

Choose the selection API and controlled dropdown/popover pattern when mounting. Use a new key to switch either.

Do

  • Filter a list, table or other set of results by a specific attribute.
  • Use a dropdown for one choice and a checkbox popover for multiple choices.
  • Give each filter a meaningful label and its Clear button an accessible name.

Don’t

  • Use a filter pill as a general-purpose action button.
  • Use a filter pill for a standalone on/off setting.

The next two examples use this Vue setup:

import { ref } from 'vue';

const selectedMessage = ref('all');
const selectedChannels = ref([]);

Controlled single selection

Use a string or null for selected. Each option needs a unique string value and a label. shortLabel changes the pill text; null falls back to label. You can replace options or translated labels while the dropdown stays open.

Set neutral-value to the choice that Clear restores. That choice stays checked without making the pill active. Omit it or use null for no neutral choice; an empty string is valid. Nothing is selected automatically.

Arrow keys move focus without changing selection. The filter’s label stays available to screen readers.

Use null when nothing is selected.

Unavailable choices and groups

In a controlled single-selection dropdown, each option can also have:

  • disabled: true to keep a choice visible but unavailable. Activating it does nothing, and the menu stays open.
  • description for short text under the label, such as why the choice is unavailable. It's also the row's accessible description.
  • group for a section heading. Consecutive options with the same group share one section, in the order you supply. Ungrouped options stay at the top level, and headerContent stays the heading for the whole menu.

Your application decides which choices are available and supplies translated descriptions and headings. A selected option that becomes unavailable stays checked and keeps the pill’s label; recovering from it is up to your application. Clear still restores neutral-value. Changing these fields while the menu is open keeps focus on the same choice.

For disabled, null or an omitted field means the choice is available. For description and group, null, an omitted field or an empty string means the field is absent. A malformed value is ignored with a development warning and doesn’t disable the pill. Multiple-selection popovers ignore all three fields.

Controlled multiple selection

Use an array of strings for selected. Changes apply immediately unless you set defer-selection. Apply saves deferred edits; Cancel, Escape and dismissal discard them. Clear resets selected to [].

A different selected value replaces pending edits. Replacing it with the same selections, or changing the options, preserves them, including selections temporarily missing from the options.

The content slot provides pendingSelected, apply and cancel; the existing v-model API uses pendingFilters.

In a custom footer, call apply() alone. It saves and closes on success. Calling apply(); close() cancels the pending Apply. Changes to selected in the same handler, before or after apply(), take priority. If you need to change selected after asynchronous work, finish await apply() first. Otherwise Apply may overwrite that change.

Await apply() before work that depends on it. This does not wait for closing; opened(false) reports that closing has finished. Outside an open deferred-selection session, apply() does nothing.

Closing before removal

Use v-model:open to keep your application’s open state in sync with the pill. People can still open it when open is false. If you handle update:open yourself, accept those updates; setting an unchanged false again cannot close it. Disabling the pill or making it read-only closes it.

You can remove an open or closing pill, for example during navigation or when replacing a header: removal releases its scroll lock, and other open overlays keep theirs. Removal skips the closing transition and focus restoration, so move focus to an element that remains. For a controlled pill, to let the menu close visibly first, close it and wait for opened(false) before removing it. A pill using the existing v-model API does not emit opened; remove it directly.

open(false) and update:open(false) report that closing has started. opened(false) follows the completed transition and focus restoration. A cancelled close does not emit opened(false).

The example then moves focus to Reset. A pill that has never opened can be removed directly. The existing v-model API keeps its open-event timing.

Labels and counts

Use anchorEnd and optionEnd to add counts while keeping the built-in labels and selection behavior. Hide the decorative badge from screen readers and provide its meaning as text. Translate count text with your application’s plural rules.

Use selection-change when choosing a filter also runs an application command. It provides value, previousValue, reason and changed. Update selection in this handler or through v-model:selected, using one write path. Don’t write it again from clear.

Choosing the current radio item still emits selection-change with changed: false. Updating props or counts does not emit it or close the menu.

The badge shows 99+ above 99 and hides at zero. Screen readers receive the full count.

Combined filters

These examples use v-model. Reset updates the items in the existing arrays.

Variants

Base

Active

For single selection, the neutral choice keeps the pill inactive. Any other selected value, including a value missing from options, makes it active and clearable.

For multiple choices, the summary shows “All” only when every option is selected, more than one option exists and no selected values are unknown. Otherwise, it shows the first matching label in selection order, or “Unavailable” if none match.

With v-model, active: true makes an item active.

Disabled

Read only

Its value is reflected in the filter set but cannot be opened, cleared, or modified. Functionally and visually distinct from disabled.

Size

200 (small) is the default.

Interaction patterns

Both overlays default to a minimum inline size matching the entire FilterPill, including its Clear button. Longer content can make the overlay wider. Set overlay-min-inline-size="300" to use --dt-layout-300, following DtBox's fixed layout scale; percentage values are not supported. Use overlay-min-inline-size="0" for natural content sizing. The default is anchor; popover-max-width still caps the overlay.

Popover content defaults to block spacing 100 and inline spacing 150. Padding utilities passed through popover-content-class override these defaults. Set popover-padding to none, small, medium, or large for a uniform padding preset; large restores the previous d-p-200 content padding. For custom padding, use popover-padding="none" with popover-content-class, for example popover-content-class="d-py-150 d-px-200". Header/footer spacing and dropdown padding are unchanged.

Clearable

A clear button appears when any filter is active. It emits the clear event when clicked.

Non clearable

Setting the :show-clear="false" prop hides the clear button.

Defer selection

Setting defer-selection holds checkbox changes in a pending state until Apply is clicked. Cancel, Escape, or clicking outside discards pending changes.

Setting use-dropdown switches the overlay from a popover to a dropdown with keyboard-navigable list items. This provides arrow key navigation, highlight management, and Enter/Space selection out of the box — ideal for single-select filter patterns. Use role="menuitemradio" with :selected for persistent, mutually exclusive choices; use menuitem for actions. The radio role exposes aria-checked independently of keyboard highlight. Built-in dropdown rows reserve space for the selected checkmark. For custom content, keep a decorative checkmark in each row and use d-vi-hidden on unselected markers, as shown below, to retain its layout space.

Slots

Default

The default slot replaces the built-in anchor-label content. Preserve the filter dimension and current selection in its accessible name; the label prop alone does not add that context after you replace the content. See Labelling guidelines.

Example: Count

Using the default scoped slot, you can display a count of active filters alongside the label.

Example: Active filter list

activeFilterList returns the first active label, or the literal 'All' when every item in a multi-item list is active. activeFilterOverflow returns text such as '+2'. Translate text you render through these slots; built-in controlled summaries use Dialtone translations.

Example: Radio selection

Combining the default and content slots with a radio group creates a single-select filter. The label updates to show the selected option, and a clear button resets to the default.

Content

Using the content slot, you can override the popover content with custom markup.

In a controlled dropdown, headerContent adds a heading. If you replace content, provide your own headings, accessible name, roles and keyboard handling. The built-in dropdown heading is omitted. Popover headers keep their existing behavior.

Content Mode

Filter Pill popover and dropdown content renders outside the DOM tree. Use the contentMode prop to apply color mode (invert, light, dark) to the positioned content. See Positioned Components for details.

Accessibility

The filter pill is built on DtButton and DtPopover/DtDropdown, inheriting their keyboard and screen reader support.

Keyboard interaction

Key Action
Enter / Space Opens the popover or dropdown; toggles checkboxes inside
Arrow Up / Arrow Down Opens the popover; navigates list items in dropdown mode, including unavailable ones and across groups
Escape Closes the popover or dropdown, discarding pending changes in deferred mode
Tab Moves focus between the primary button, checkboxes, footer actions, and the clear button

ARIA attributes

  • The primary button uses aria-disabled="true" in read-only mode instead of disabled, preserving focusability while indicating the control is not interactive.
  • The checkbox group inside the popover receives aria-label set to the pill's label prop, giving screen readers context for the list of options.
  • The clear button uses aria-label set to endTooltipText (or a localized default), ensuring the icon-only button has an accessible name.

Unavailable choices and groups

  • An unavailable choice uses aria-disabled="true". It stays focusable and reachable with the arrow keys, Home, End and typeahead, so keyboard and screen reader users can find it and hear why it's unavailable. This follows the WAI-ARIA Authoring Practices guidance on focusability of disabled controls, which keeps disabled menu items focusable.
  • Activating an unavailable choice with a pointer, Enter or Space does nothing; Escape, Tab and outside clicks still close the menu.
  • A description is the row's accessible description, read after its name, through aria-describedby. It isn't repeated in the name.
  • Group headings label their group and aren't focusable. Typeahead matches option labels, not descriptions or headings.
  • Explain unavailability in the description rather than a tooltip, so touch, keyboard and screen reader users get it too.

Labelling guidelines

  • Provide a meaningful dimension label, such as Conversation type. Built-in controlled labels include the dimension and current selection in the accessible name even when only the selection is visible. A separate external visual label is not required.
  • When replacing the default slot, include both the dimension and current selection in its accessible content. A screen-reader-only prefix, as shown in the custom-label examples, preserves context while keeping the visible label compact. Use anchorEnd or optionEnd when adding counts without replacing the built-in label.
  • Use start-tooltip-text to repeat the dimension on hover when helpful. The tooltip does not replace a contextual accessible name; users should still understand the filter when they return focus after selecting a value.
  • Provide end-tooltip-text for the clear button to give it a meaningful accessible name (e.g., "Remove filter").

Vue API

An options array at mount enables controlled selection. Omitted, undefined, null or other non-array values use the existing v-model API. Invalid inputs disable a controlled pill until corrected; they do not switch it back to v-model. FilterPill does not change your option or selection data.

import { DtFilterPill } from '@dialpad/dialtone-vue';

Slots

Name
Type
anchorEnd

Noninteractive controlled trailing anchor content, retaining the built-in label.

content

Override overlay content. Bindings are conditional on the selection contract.

default

Customize the anchor label. Legacy and controlled bindings are conditional on options.

footerContent

Allows you to customize the popover footer. Receives { close, apply, cancel } bindings.

headerContent

Popover header or noninteractive built-in controlled dropdown heading.

optionEnd

Noninteractive trailing choice content, retaining its label and handler.

startIcon

Icon displayed before the label

Props

Name
Default
Type
anchorEndClass
''
string|array|object

Classes on the immediate noninteractive anchorEnd wrapper.

contentMode
null
"light" | "dark" | "invert"

Applies a color mode to the positioned content element.

deferSelection
false
boolean

When true, checkbox changes are held in a pending state until the user clicks Apply. Cancel or closing the popover discards pending changes. Applies to popover mode.

disabled
false
boolean

HTML disabled attribute

dropdownListClass
''
string|array|object

Additional CSS class(es) applied to the dropdown list wrapper. Only applies when useDropdown is true.

endTooltipText
''
string

Text shown in tooltip when you hover the end button, required as it is an icon only button

headerContentClass
''
string|array|object

Classes on the immediate headerContent wrapper.

label
string

Label of the button

labelClass
''
string|array|object

Additional CSS class(es) applied to the label wrapper element.

modelValue
[]
array

Array of filters to display in the popover, should be an array of objects with name and active properties

neutralValue
string

Single-selection baseline. Null or omitted means absent; empty string is meaningful. Ignored in multiple selection.

open
null
boolean|null

Logical visibility synchronization for controlled selection. Null uses internal ownership.

optionEndClass
''
string|array|object

Classes on each immediate noninteractive optionEnd wrapper.

options
array

An array at creation (including []) opts into authoritative selection. Remount to change contract or controlled pattern. Records require string value and label. Optional shortLabel accepts string or null; null is absent and empty string is meaningful. Single-selection dropdowns also read optional disabled (boolean or null) and description and group (string or null; an empty string is absent). A malformed value is ignored with a development warning and never invalidates the options. Multiple selection ignores these three fields and warns once.

overlayMinInlineSize
'anchor'
"anchor" | "0" | "1px" | "2px" | "8px" | "25" | "20px" | "24px" | "50" | "75" | "100" | "125" | "150" | "175" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800" | "850" | "900" | "950" | "1000" | "1050" | "1100" | "1150" | "1200" | "1250" | "1300" | "1350" | "1400" | "1450" | "1500" | "1550" | "1600"

Minimum overlay inline size (aka left/right extent). Anchor uses the entire pill, including Clear. Fixed layout values follow DtBox: 300 maps to --dt-layout-300; 0 uses natural sizing. Percentages are not supported. The popoverMaxWidth cap still applies.

popoverAppendTo
'body'
"body" | "parent" | "root"

Sets the element to which the popover component is going to append to. An HTMLElement is also accepted.

popoverContentClass
''
string|array|object

Additional CSS class(es) applied to the popover content area. Applies to popover mode.

popoverDialogClass
''
string|array|object

Additional CSS class(es) applied to the popover dialog element. Applies to popover mode.

popoverFallbackPlacements
['auto']
"top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "left" | "left-start" | "left-end" | "bottom" | "bottom-start" | "bottom-end" | "auto" | "auto-start" | "auto-end"

If the dropdown does not fit in the direction described by "popoverPlacement", it will attempt to change it's direction to the "popoverFallbackPlacements".

popoverFooterClass
''
string|array|object

Additional CSS class(es) applied to the outer popover footer element (d-popover__footer). Applies to popover mode.

popoverHeaderClass
''
string|array|object

Additional CSS class(es) applied to the outer popover header element (d-popover__header). Applies to popover mode.

popoverMaxHeight
''
string

Determines maximum height for the popover before overflow. Possible units rem|px|em

popoverMaxWidth
''
string

Determines maximum width for the popover before overflow. Possible units rem|px|%|em

popoverPadding
"none" | "small" | "medium" | "large"

Padding preset for the popover content. Omit for compact block 100 / inline 150 spacing. Set large to restore the previous content padding.

popoverPlacement
'bottom-start'
"top" | "top-start" | "top-end" | "right" | "right-start" | "right-end" | "left" | "left-start" | "left-end" | "bottom" | "bottom-start" | "bottom-end" | "auto" | "auto-start" | "auto-end"

The direction the popover displays relative to the anchor. Tippy.js docs

readOnly
false
boolean

When true, the pill cannot be interacted with but does not receive disabled visual styling. Adds d-filter-pill--read-only class and hides the chevron icon. The clear button is suppressed and the tooltip falls back to a read-only message when startTooltipText is not provided.

selected
string|array

Controlled selection: string|null in dropdowns, readonly string[] in popovers.

showClear
true
"true" | "false"

Shows the clear button when a filter is active

size
200
"100" | "200" | "300" | "400" | "500"

The size of the button.

startTooltipText
''
string

Text shown in tooltip when you hover the start button, required if no content is passed to default slot

useDropdown
false
boolean

When true, uses DtDropdown instead of DtPopover as the overlay. Provides keyboard navigation (arrow keys) for list items. Default content renders DtListItem elements (single-select) instead of checkboxes (multi-select).

Events

Name
Type
apply

Emitted when deferred selection is applied

clear
Boolean | Array

Emitted when clicking the clear button

open
Boolean | Array

Logical visibility notification when the overlay is shown or dismissed

opened
boolean

Controlled-only completed overlay visibility, after focus and scroll cleanup. Removing the pill while open or closing releases its scroll lock. To let it close visibly first, remove it after opened(false).

selection-change
undefined

User action snapshot: value, previousValue, reason and changed. @type {Object}

update:modelValue
Array

Emitted when the active filters change

update:open
undefined

Logical visibility synchronization when controlled open is boolean. @type {boolean}

update:selected
undefined

Proposed controlled value. The parent remains authoritative. @type {string | null | Array}

Classes

Class
Applies to
Description

Filter Pill documentation last updated Wednesday, December 2, 2026