glaze/oat/taginput

Oat documentation: https://oat.ink/components/taginput/

A text input that turns words into removable tags on Enter or comma. This requires Oat’s JavaScript.

The element dispatches a bubbling input event whenever a tag is added or removed. The .value property holds the current list of tags.

Recipe

import glaze/oat/taginput
import lustre/attribute
import lustre/element/html

fn tags() {
  taginput.taginput([taginput.value(["apple", "mango"])], [
    html.input([attribute.placeholder("Add tags ...")]),
  ])
}

Values

pub fn taginput(
  attrs: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

Wrap a single <input>. Add a <datalist> via the input’s list attribute for autocomplete.

pub fn value(tags: List(String)) -> attribute.Attribute(msg)

Initial tags.

✨ Search Document