Ir al contenido

co-tags-field

Campo de etiquetas de texto libre: escribe un valor y pulsa Enter, Tab o coma para añadirlo como chip. Backspace borra el último chip y el doble clic edita uno en línea. Es el renderer de campos de esquema con tipo array de primitivos. El value es un array JSON de strings.

Ver código
<co-tags-field label="Etiquetas" placeholder="Escribe y pulsa Enter" value='["alpha","beta"]' clearable></co-tags-field>

Props

PropAtributoTipoDefaultDescripción
allowDuplicatesallow-duplicatesbooleanfalseAllow the same value to be added more than once.
clearableclearablebooleantrue
disableddisabledbooleanfalse
errorMessageerror-messagestring | undefinedMessage shown when invalid.
helperTexthelper-textstring | undefinedHelper text shown when valid.
invalidinvalidbooleanfalseExternal invalid flag (e.g. from a form controller).
labellabelstring | undefined
layoutlayout"horizontal" | "vertical"'vertical'Label layout: vertical (label above) or horizontal (label beside)
maxTagsmax-tagsnumber | undefinedMaximum number of tags allowed (no cap when undefined).
namenamestring | undefined
placeholderplaceholderstring''
readonlyreadonlybooleanfalse
requiredrequiredbooleanfalse
sizesize"lg" | "md" | "s" | "sm"'md'Field size (mirrors co-input): s 28 / sm 32 / md 40 / lg 48.
valuevaluestring | string[]'[]'Committed value as a JSON array of strings (or an actual `string[]`).

Eventos

EventoDetailBubblesCancelableDescripción
coBlurvoid
coChangestring[]Emitted with the full array on every add/edit/remove/clear.
coClearvoidEmitted when the clear-all button is clicked.
coFocusvoid
coInputstringEmitted on every keystroke of the inline input with the raw text.

Slots

Este componente no expone slots.

CSS Parts

PartDescripción
::part(clear)The clear-all button
::part(field)The bordered chip+input row
::part(helper)The helper/error text row
::part(input)The native text input
::part(label)The field label
::part(wrapper)Root container

CSS Custom Properties

Este componente no expone CSS custom properties.