Skip to content

Chip Field

BsChipField is a component that let users enter arbitrary items, like categories or tags into an UI to convey a small pieces of information.

Overview

BsChipField uses BsChip internally and mimics like HTML5 <input type="text"> element with tagging functionality. This means that you can add attributes like required, readonly, or disabled and it will react to them to give the best experience. You can also use v-model directive to create two-way data bindings on the model-value property.

Sandra
Adams
Sandra
Adams

IMPORTANT

Do not use the model-value property when using v-model.

Style Variants

You can style <bs-chip-field> to your own preference or use a style variant based on Google Material Design 2 or Material Design 3 specifications.

Default

You can style <bs-chip-field> that follows Google Material Design 2 specifications by using floating-label property explicitly.

Filled

Use filled property explicitly to enable <bs-chip-field> with solid fill style. And when combined with floating-label property, <bs-chip-field> will have a style that follows the Google Material Design 3 specifications.


Outlined

Use outlined property explicitly to enable <bs-chip-field> with outline style. And when combined with floating-label property, <bs-chip-field> will have a style that follows the Google Material Design 3 specifications.


Chip Styles

The chip items can also be styled. The guide below shows you how to style the chip items.

Chips Color

The chip's color can be set using the chip-color property. Any color variant from MDBootstrap colors and Material colors can be applied to the <bs-chip-field>.

Outlined Chips

Use chip-outlined property explicitly to create chip items with outlined shape style.

Rounded Pill Chips

Use chip-pill property explicitly to create chip items with rounded-pill shape style.

Outlined Rounded Pill Chips

Use both chip-outlined and chip-pill property explicitly to create chip items with outlined rounded-pill shape style.

Clearable

Define the clear-button property explicitly, so that the field value can be cleared easily.

Deletable Chip

Define the chip-deletable property explicitly, so that existing chip items can be easily deleted.

Real value: []

Help Text

The help-text property on <bs-chip-field> adds an help text beneath the Field. And sets the persistent-help-text property to false will make the help text visible only when the Field is focused.

Enter website keywords
Enter website keywords
Enter website keywords

Icons

The properties prepend-icon, prepend-icon-outer, append-icon and append-icon-outer provides the ability to add icon to <bs-chip-field>.

Use any valid android icon name from Google Material Symbols with or without a suffix. Valid suffixes are: _outlined, _rounded, _sharp, _filled, _outlined_filled, _rounded_filled, and _sharp_filled. Suffix _filled and _outlined_filled will display the same icon style variant.

Updated on v2.1.0

INFO

Since Vue MDBootstrap v2.1.0, Google Material Icons are replaced with Google Material Symbols.

CSS Variables

Added since v2.0.0
scss
--md-field-active-border-color: rgb(var(--md-field-active-indicator));
--md-field-active-border-width: 2px;
--md-field-color-bg: currentColor;
--md-field-border-color: currentColor;
--md-field-border-width: 1px;
--md-field-floating-label-color: var(--md-field-label-color);
--md-field-label-color: currentColor;

// global css variables
--md-field-primary-indicator-rgb: 98, 0, 238;
--md-field-primary-indicator: rgb(var(--md-field-primary-indicator-rgb));
--md-field-accent-indicator-rgb: 185,156,225;
--md-field-accent-indicator: rgb(var(--md-field-accent-indicator-rgb));
--md-field-active-indicator: var(--md-field-primary-indicator-rgb);

API Reference

TValidator

The validator configuration option has properties as described below:

PropertyTypeDescription
validatorsRecord<String,Boolean>External validator plugin validation result.
messagesRecord<String,String>Validation message for each validation types.
hasErrorBooleanAn indicator that tells the field value pass the validation or not.
dirtyBooleanValue comes from validator plugin that indicate the field is dirty or not.

All properties are mandatory.

NOTE

Vue MDBootstrap does not include form validation by default, we leave that up to the 3rd party form validation plugin. As of now, Vuelidate has been fully tested with our component library.

Released under the BSD-3-Clause License.