A text input that turns recognized values into removable rounded tokens
一种文本输入框,能把识别出来的值变成可移除的圆角令牌
also called也叫
token input, recipient field, tag input, pill input令牌输入、收件人栏、标签输入框、胶囊输入框
If you called it…如果你管它叫……
“the text field with removable pills inside it”「里面带可删小胶囊的文本框」
“the email address bubbles in the To field”「收件人栏里的邮箱气泡」
“input that turns words into little tags”「能把词变成小标签的输入框」
“rounded chips you can delete from a field”「输入框里可以删掉的圆角小片」
“the field where each recipient becomes its own bubble”「每个收件人都变成一个气泡的那个输入框」
Tags:
DesignQ3 Report
标本可交互,可以直接操作。
Anatomy — every part, named解剖 —— 每个部件的名字
1Token capsule令牌胶囊NSTokenField.TokenStyle
“The little rounded bubble around each recipient” is a token capsule.
「每个收件人外面那层圆角小气泡」就是令牌胶囊。
Prompt fragmentPrompt 片段
an NSTokenField.TokenStyle token capsule wrapping one recognized value inside the field
一个 NSTokenField.TokenStyle 令牌胶囊,在输入框里包裹一个识别出的值
2Selected token选中的令牌NSTokenField
“The whole pill that highlights before I delete it” is the selected token.
「删除前整个高亮的那粒胶囊」就是选中的令牌。
Prompt fragmentPrompt 片段
the selected NSTokenField token with its native highlight, ready for keyboard deletion or editing
NSTokenField 中选中的令牌,带原生高亮,等待键盘删除或编辑
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
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调试 Prompt —— 当它不听话时
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:
调试我的 macOS 令牌输入框(NSTokenField)。排除以下可能:tokenizing character set 里缺了你的分隔符,导致按 Return 才把文本变成令牌;delegate 里把 represented object 和显示字符串搞混,令牌显示出原始标识符;没实现补全的 delegate 方法,补全列表永不出现;没实现向粘贴板写 represented object,复制出来只有纯文本。症状是:
# Token Field · 令牌输入框
UI reference — https://K3tty5555.github.io/LearnUI_PM/macos/token-field/
**A text input that turns recognized values into removable rounded tokens**
一种文本输入框,能把识别出来的值变成可移除的圆角令牌
**Also called / 也叫:** token input, recipient field, tag input, pill input / 令牌输入、收件人栏、标签输入框、胶囊输入框
## Anatomy — every part, named / 解剖
1. **Token capsule · 令牌胶囊** (`NSTokenField.TokenStyle`)
“The little rounded bubble around each recipient” is a token capsule.
「每个收件人外面那层圆角小气泡」就是令牌胶囊。
Prompt fragment: an NSTokenField.TokenStyle token capsule wrapping one recognized value inside the field
2. **Selected token · 选中的令牌** (`NSTokenField`)
“The whole pill that highlights before I delete it” is the selected token.
「删除前整个高亮的那粒胶囊」就是选中的令牌。
Prompt fragment: the selected NSTokenField token with its native highlight, ready for keyboard deletion or editing
## Prompt / 提示词
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.
使用原生令牌输入框(NSTokenField)和 NSTokenField.TokenStyle,让每个识别出的收件人或标签都变成可单独选中、可删除的圆角令牌。保留令牌自动补全和键盘删除行为。
## Debug prompt / 调试提示词
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:
调试我的 macOS 令牌输入框(NSTokenField)。排除以下可能:tokenizing character set 里缺了你的分隔符,导致按 Return 才把文本变成令牌;delegate 里把 represented object 和显示字符串搞混,令牌显示出原始标识符;没实现补全的 delegate 方法,补全列表永不出现;没实现向粘贴板写 represented object,复制出来只有纯文本。症状是:
## In code / 代码里叫什么
- **AppKit** `NSTokenField`
- **AppKit** `NSTokenField.TokenStyle`
- **AppKit** `NSTokenFieldDelegate`