Skip to content

Tag input โ€‹

A multi-value tag entry with optional autocomplete suggestions, validation states, max-tags limit, and slot-overridable label/helper. Tags are added with Enter, , or Tab, and removed with ร— or Backspace on an empty input. Toggle Vue / CSS to switch the live demo and source together.

Basic โ€‹

Default tag input that accepts custom values.

Vue SFC

Sizes โ€‹

Small, medium and large.

Vue SFC

Variants โ€‹

outlined, filled and underlined.

Vue SFC

Colors โ€‹

All built-in color variants.

Vue SFC

States โ€‹

Disabled, readonly and required.

Vue SFC

Validation โ€‹

valid, invalid and warning states with messages.

Vue SFC

Suggestions โ€‹

Autocomplete dropdown driven by an items array.

Vue SFC

Max tags โ€‹

Limit how many tags can be added.

Vue SFC

Slots โ€‹

Custom label and helper content via named slots.

Vue SFC

Event log โ€‹

Live log of mno-add, mno-remove, mno-clear and mno-change.

Vue SFC

Customized โ€‹

Override per-element styling with cssClass (Vue) or utility classes (CSS).

Vue SFC

Custom keys โ€‹

Use key-value and display-value to feed natural-shape items (for example { id, name }) without pre-mapping. key-value names the property stored in each tag of modelValue; omit it to store the whole item object. display-value is either a property name (string) or a (item) => string function โ€” when unset it falls back to item.label.

Vue SFC

DataSource (devextreme) โ€‹

Bind a live devextreme DataSource with :data-source.prop. Suggestions come straight from the source, typing filters the loaded set client-side, and load-more="scroll" pages it one chunk at a time (here pageSize: 5). :immediate.prop="true" loads the first page on attach. This example builds the source with mono-utils' monoOdataFetch against a public OData endpoint (baseUrl, no configBaseUrl). Bind with .prop and use key-value / display-value to map the server fields.

Checkable + max โ€‹

Add checkable for a checkbox multi-select: each suggestion row shows a checkbox (reusing mono-checkbox's styling), selected rows stay in the list checked instead of disappearing, and the dropdown stays open so you can tick several. Chips reuse mono-chip styling. The max prop caps how many chips show inline โ€” the rest collapse into a clickable "+N more" chip whose dropdown lists them. Works with a raw items array (shown here) and a bound DataSource alike.

Vue SFC

Search the server โ€‹

Typing already filters the loaded suggestions client-side. Set search-value (the field[s] to search) and, with a bound DataSource, typing queries the server (debounced) so the dropdown shows matches from the whole dataset โ€” then tick rows to add tags. load-more="scroll" pages the filtered results; search-operation (default contains) and search-debounce (default 300ms) tune it. A plain items array filters client-side.

Grouped options โ€‹

display-group is an array with one accessor per level โ€” a string reads a field off the row, a function receives the row (:display-group.prop="['BrandNama', (row) => row.DeptNama]") โ€” used as both the group key and the header label. Selected tags, key-value / display-value and search all work on the leaf rows.

group (recommended for a DataSource). Pass a plain, paginated source โ€” no group in its request, so paging stays on โ€” and add the boolean group prop. mono-tag-input fetches flat rows page by page (so load-more keeps working) and buckets the accumulated rows by display-group. Add group-sticky to pin headers while rows scroll. Each request is a normal $skip/$top page (never $apply=groupby):

group also works on a static array โ€” 1,200 records generated with map, grouped two levels (team โ†’ role), sticky headers, load-more="scroll" revealing a chunk at a time:

Vue SFC

Pre-grouped data. If your data is already nested as { key, items }, omit group and it renders directly. group-key / group-items name the key and child-array fields (default 'key' / 'items'). This static array uses custom group-key="k" / group-items="rows":

Vue SFC

Width & height โ€‹

Set width, height, min-width, max-width, min-height or max-height โ€” each takes a CSS string ("320px", "80%") or a number (px). Fields are full width by default; set width to constrain.

Vue SFC

Types โ€‹

Importimport { TagInputProps } from 'mono-helper'
PropValueDefaultDescription
modelValueunknown[][]Two-way bound array of selected tag values.
valueunknown[][]Selected tag values (kept in sync with modelValue).
itemsstring | TagInputItem[][]Suggestion items to choose from.
dataSourceTagInputDataSource<TagInputItem>โ€”DataSource driving the suggestions; takes precedence over items.
immediatebooleantrueDataSource-only: auto-load the source on attach when it has no items yet.
loadMore'' | 'button' | 'scroll' | booleanโ€”Incremental loading mode; enabling defaults to scroll, button opts into a button.
pageSizenumber10Chunk size used when paging a plain items array (default 10).
dropdownHeightstring | number''Fixed height of the scrollable suggestions list.
dropdownMaxHeightstring | number''Max height of the scrollable suggestions list.
keyValuestring''Property name on each item used as the stored tag value.
displayValuestring | (item: TagInputItem) => string''Property name or selector function deriving each item's display text.
displayGroupTagInputDisplayGroup[]Per-level accessors for grouped options (header label per group level).
groupKeystring'key'Field holding a group node's key (default 'key').
groupItemsstring'items'Field holding a group node's child array (default 'items').
groupbooleanfalseGroup a plain, paginated DataSource (or flat array) client-side.
groupStickybooleanfalseKeep group headers pinned to the top while their rows scroll.
searchValuestring | string[]''Field(s) the search matches (server `searchExpr` + client filter target).
searchOperationstring'contains'devextreme search operation for server search (default 'contains').
searchDebouncenumber300Debounce (ms) before a server search fires (default 300).
size'sm' | 'md' | 'lg''md'Size of the tag input.
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info''primary'Color theme of the tag input.
variant'underlined' | 'outlined' | 'filled''outlined'Visual style of the tag input.
labelstring''Text label shown above the field.
placeholderstring'Add tag...'Placeholder text shown when the input is empty.
helperTextstring''Helper text shown below the field.
validationState'warning' | 'default' | 'valid' | 'invalid''default'Validation state controlling field styling.
validationMessagestring''Message shown for the current validation state.
errorMessagestring''Error message that forces the invalid state.
successMessagestring''Success message that forces the valid state.
namestring''Form field name for the underlying input.
disabledbooleanfalseDisables interaction with the tag input.
readonlybooleanfalseMakes the tag input read-only.
requiredbooleanfalseMarks the field as required.
clearablebooleanfalseShows a clear button to remove all tags.
allowCustombooleantrueAllows adding custom tags not present in the items.
duplicatebooleanโ€”Allows duplicate tag values.
maxTagsnumberโ€”Maximum number of tags that can be added.
checkablebooleanfalseCheckbox multi-select mode (selected rows stay checked, dropdown stays open).
maxnumberโ€”Max chips shown inline; the rest collapse into a clickable "+N more" chip.
ariaLabelTextstringโ€”Accessible label for screen readers.
ariaLabelstringโ€”โ€”
widthstring | numberโ€”Explicit sizing of the field. Each accepts a CSS length string (`"320px"`, `"80%"`) or a number (interpreted as px). Use `width="100%"` for full width. (Distinct from `dropdownHeight`/`dropdownMaxHeight`, which size the popup.)
heightstring | numberโ€”โ€”
minWidthstring | numberโ€”โ€”
maxWidthstring | numberโ€”โ€”
minHeightstring | numberโ€”โ€”
maxHeightstring | numberโ€”โ€”
cssClassTagInputCssClass{}Per-part class overrides for styling internal elements.