Tag Input

以可移除的标签块输入标签:按 Enter 或逗号添加,按退格键删除最后一个,可作为表单控件使用。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 暂不可用

用法

  • design
  • planning
  • q3

Press Enter or type a comma to add a tag.

导入

ts
import {
  SoneTagInputComponent,
} from "@surface-one/angular/tag-input";

API 参考

SoneTagInputComponent组件

Tags as removable chips — a ControlValueAccessor of `string[]`. Enter or a comma adds the typed tag (a pasted "a, b, c" adds three), Backspace in the empty field removes the last one. Duplicates are refused case-insensitively.

选择器
sone-tag-input
输入
名称类型 默认值
value双向readonly string[][]
placeholderstring""
ariaLabel

The text field's accessible name.

string | null$localize`Add tag`
inputIdstring | nullnull
max

At most this many tags; further ones are rejected with reason `max`.

number | nullnull
maxVisible

Show this many chips and a "+N more" toggle for the rest.

number | nullnull
suggestions

Offered while typing (a native `<datalist>`).

readonly string[][]
validate

Return `false` to refuse a tag (reason `invalid`).

((tag: string) => boolean) | nullnull
variant

The chips' badge variant.

BadgeVariant"secondary"
disabledbooleanfalse
invalidbooleanfalse
输出
名称类型
addedstring
removedstring
rejectedSoneTagRejection