Disclosure Triangle 披露三角 macos
The small rotating control that reveals or hides nested content
那个会旋转的小控件,用来显示或隐藏嵌套内容
标本可交互 —— 点点看。Specimen is live — try it.
Anatomy — every part, named解剖 —— 每个部件的名字
-
1 Disclosure indicator披露指示器
NSButton.BezelStyle.disclosure“The tiny triangle beside the row” is the disclosure indicator.
「行旁边那个小三角」就是披露指示器。
Prompt fragmentPrompt 片段a native disclosure indicator using NSButton.BezelStyle.disclosure beside the expandable label
可展开标签旁边的原生披露指示器,使用 NSButton.BezelStyle.disclosure
-
2 Collapsed state折叠状态
DisclosureGroup.isExpanded“The arrow pointing sideways before it opens” is the collapsed state.
「打开前朝侧面的箭头」就是折叠状态。
Prompt fragmentPrompt 片段the collapsed DisclosureGroup.isExpanded = false state, with the indicator pointing sideways and children hidden
折叠状态(DisclosureGroup.isExpanded = false):指示器指向侧面,子级隐藏
-
3 Expanded state展开状态
DisclosureGroup.isExpanded“The arrow rotated down after it opens” is the expanded state.
「打开后转向下方的箭头」就是展开状态。
Prompt fragmentPrompt 片段the expanded DisclosureGroup.isExpanded = true state, with the disclosure indicator pointing down above the revealed children
展开状态(DisclosureGroup.isExpanded = true):披露指示器指向下方,露出的子级在它下面
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
Use a native Disclosure Triangle for expandable rows: NSOutlineView for an outline hierarchy or SwiftUI DisclosureGroup for a standalone section. The small indicator must rotate between collapsed and expanded states while the row's children appear directly beneath it.
可展开的行用原生披露三角:大纲层级用 NSOutlineView,独立区块用 SwiftUI DisclosureGroup。小指示器必须在折叠和展开状态之间旋转,同时该行的子级直接出现在它下方。
Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时
Debug my macOS disclosure triangle (NSButton .disclosure bezel, SwiftUI DisclosureGroup). Rule out: the isExpanded binding not actually driving the revealed content; several groups sharing one binding so they all toggle together; the triangle animating the wrong direction because state and rotation are set separately; baseline misalignment between the triangle and its label. The symptom:
调试我的 macOS 披露三角(NSButton .disclosure bezel、SwiftUI DisclosureGroup)。排除以下可能:isExpanded 绑定没有真正驱动显示的内容;多个 DisclosureGroup 共用一个绑定,结果一起开合;状态和旋转分开设置,三角动画方向错了;三角和标签基线没对齐。症状是:
In code代码里叫什么
| Framework框架 | Symbol符号 | Note说明 |
|---|---|---|
| AppKit | NSOutlineView | |
| SwiftUI | DisclosureGroup | |
| AppKit | NSButton.BezelStyle.disclosure | a standalone disclosure button style一种独立的披露按钮样式 |