The removable pills inside the field are tokens — type one and press ⏎
Token Field
/ NSTokenField · NSTokenField.TokenStyle /
also called token input, recipient field, tag input, pill input
A token field converts recognized pieces of typed text into discrete rounded tokens, like recipients in a mail compose window. Each token represents one value and can be selected, edited, or removed without treating the whole field as plain text. AppKit provides token styling, completions, represented objects, and tokenizing separators through NSTokenField.
If you called it…
…you meant a token field.
Anatomy — every part, named
- 1Token capsule
NSTokenField.TokenStyle“The little rounded bubble around each recipient” is a token capsule.
- 2Selected token
NSTokenField“The whole pill that highlights before I delete it” is the selected token.
Prompt — paste into your agent
Use a native Token Field (NSTokenField) with NSTokenField.TokenStyle so each recognized recipient or tag becomes a separately selectable, removable rounded token inside the editable field. Preserve token completion and keyboard deletion behavior.
Debug prompt — when it misbehaves
Paste this, then describe what you’re seeing — it hands your agent the classic failure modes to rule out first.
Debug my macOS token field (NSTokenField). Rule out: text not becoming tokens until Return because the tokenizing character set lacks your separator; represented objects vs display strings confused in the delegate so tokens show raw identifiers; completions never appearing because the completion delegate method is not implemented; copy producing plain text because writing represented objects to the pasteboard is unimplemented. The symptom:
In code
The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).
| AppKit | NSTokenField | |
| AppKit | NSTokenField.TokenStyle | |
| AppKit | NSTokenFieldDelegate |