Mixins / foldkit-mixins-ui

TagsInputSlots

const · packages/mixins-ui/src/tagsInput.ts:43

const TagsInputSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly control: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly list: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly tag: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly remove: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", read …;

A field of tags, Zag's tags input: the tags as a list of chips, each with a remove button, and a text input for the next one. Enter or the delimiter adds the draft, split at the delimiter and trimmed, refusing empty parts, tags already there and tags past max; Backspace on an empty draft removes the last tag at once. A refusal is shown: the message slot, a polite status region drawn always, says why, and the control shakes once (not under reduced motion). The tags and the draft are a small Model of this module's, which the application keeps and folds with update; Typed carries the drawing it read the text from, so a frame behind the keys loses no draft.

The chips are one tab stop. ArrowLeft and ArrowRight move among them (and ArrowRight past the last returns to the input), Home and End go to the ends, Backspace and Delete remove the focused one, and ArrowLeft in the input at the start of its text enters the last. Text keys stay the browser's.