TagEntry

A tags ("chips") input: type, press Enter or comma, and the text becomes a removable chip — labels, recipients, keywords. Fully keyboard- operable from a single Tab stop.

Live preview

Live preview. In the Player's built-in docs viewer (scriptweaver --help), this renders TagEntry as a live, theme-aware widget you can interact with.

Example

const labels = app.TagEntry({ tags: ['go', 'tcl'] });
labels.pack.configure({ fill: 'x' });

labels.bind('<<TagsChanged>>', () => save(labels.tags));

labels.tags; // ['go', 'tcl'] — any strings, spaces welcome
labels.tags = ['fresh', 'set']; // replace

Duplicates and empty entries are silently ignored. add/remove/clear are available as methods (__native_tcl(te._id, 'add', text)-level access exists too).

Keyboard

Key Action
Enter / , Commit the typed text as a chip.
Backspace (entry empty) First press highlights the last chip, second removes it — and stays armed, so repeated presses keep deleting.
at the entry's start Rove the highlight left through the chips; roves back toward the entry.
Delete / Backspace Remove the highlighted chip (the highlight moves to its neighbor).
Esc or typing Clear the highlight.

With the mouse: click a chip to highlight it, click its × to remove it. The × is a click target only — it never appears in the Tab order. Additions, removals and highlights are announced to screen readers.

Options

Option Type Description
tags array The chips, in order.
width number The minimum entry width in characters.
state string 'normal' or 'disabled' (disabled blocks all changes).

<<TagsChanged>> fires on every change — typed, clicked, or programmatic.

See also