minuit

TagInputComponent

A field that holds short texts as chips.

Java

Inside a PanelComponent constructor. The same call draws in every family and chroma.

Java
TagInputComponent tags = add(new TagInputComponent(at(new Box("tags", 10, 10, 180, 44)), this)
        .placeholder(words.get("mymod.add_tag"))
        .maxTags(8)
        .suggestions(known)
        .validator(t -> t.contains(":") ? null : words.get("mymod.needs_namespace"))
        .onChange(this::save));
add(new ButtonComponent(at(new Box("ok", 10, 60, 80, 20)), words.get("gui.done"), this::close));
// Last, so that the suggestions are drawn over the button and offered every input first.
add(tags.popup());

Chips

TagInputComponent, chips