@tanrei/mcp 0.1.0-next.0 → 0.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/NOTICE +4 -5
  2. package/README.md +21 -6
  3. package/bin/tanrei-mcp.js +3 -3
  4. package/dist/server.js +2218 -711
  5. package/dist/vocabulary/docs/governance/mimicry-gaps.json +95 -21
  6. package/dist/vocabulary/packages/tokens-build/generated/component-catalog.json +1825 -0
  7. package/dist/vocabulary/specs/accordion.spec.json +1 -0
  8. package/dist/vocabulary/specs/app-bar.spec.json +1 -0
  9. package/dist/vocabulary/specs/app-shell.spec.json +1 -0
  10. package/dist/vocabulary/specs/avatar.spec.json +1 -0
  11. package/dist/vocabulary/specs/badge.spec.json +1 -0
  12. package/dist/vocabulary/specs/bottom-sheet.spec.json +1 -0
  13. package/dist/vocabulary/specs/breadcrumbs.spec.json +1 -0
  14. package/dist/vocabulary/specs/button-group.spec.json +1 -0
  15. package/dist/vocabulary/specs/button-with-menu.spec.json +1 -0
  16. package/dist/vocabulary/specs/button.spec.json +1 -0
  17. package/dist/vocabulary/specs/calendar.spec.json +1 -0
  18. package/dist/vocabulary/specs/callout.spec.json +1 -0
  19. package/dist/vocabulary/specs/card.spec.json +1 -0
  20. package/dist/vocabulary/specs/carousel.spec.json +1 -0
  21. package/dist/vocabulary/specs/chat-composer.spec.json +1 -0
  22. package/dist/vocabulary/specs/checkbox-group.spec.json +1 -0
  23. package/dist/vocabulary/specs/checkbox.spec.json +1 -0
  24. package/dist/vocabulary/specs/chip-field.spec.json +1 -0
  25. package/dist/vocabulary/specs/chip.spec.json +1 -0
  26. package/dist/vocabulary/specs/code-block.spec.json +1 -0
  27. package/dist/vocabulary/specs/color-field.spec.json +1 -0
  28. package/dist/vocabulary/specs/color-input.spec.json +1 -0
  29. package/dist/vocabulary/specs/combobox-field.spec.json +1 -0
  30. package/dist/vocabulary/specs/combobox.spec.json +1 -0
  31. package/dist/vocabulary/specs/component.schema.json +1 -0
  32. package/dist/vocabulary/specs/copy-button.spec.json +1 -0
  33. package/dist/vocabulary/specs/date-time-picker.spec.json +1 -0
  34. package/dist/vocabulary/specs/description-list.spec.json +1 -0
  35. package/dist/vocabulary/specs/dialog.spec.json +1 -0
  36. package/dist/vocabulary/specs/divider.spec.json +1 -0
  37. package/dist/vocabulary/specs/drop-zone.spec.json +1 -0
  38. package/dist/vocabulary/specs/embedded-text-input.spec.json +1 -0
  39. package/dist/vocabulary/specs/empty-state.spec.json +1 -0
  40. package/dist/vocabulary/specs/fab-menu.spec.json +1 -0
  41. package/dist/vocabulary/specs/field-group.spec.json +1 -0
  42. package/dist/vocabulary/specs/field.spec.json +1 -0
  43. package/dist/vocabulary/specs/figure.spec.json +1 -0
  44. package/dist/vocabulary/specs/file-item.spec.json +1 -0
  45. package/dist/vocabulary/specs/file-picker.spec.json +1 -0
  46. package/dist/vocabulary/specs/file-upload.spec.json +1 -0
  47. package/dist/vocabulary/specs/handle.spec.json +1 -0
  48. package/dist/vocabulary/specs/image-preview.spec.json +1 -0
  49. package/dist/vocabulary/specs/inline-code.spec.json +1 -0
  50. package/dist/vocabulary/specs/inventory.json +1 -0
  51. package/dist/vocabulary/specs/keyboard-shortcut.spec.json +1 -0
  52. package/dist/vocabulary/specs/link-card.spec.json +1 -0
  53. package/dist/vocabulary/specs/link.spec.json +1 -0
  54. package/dist/vocabulary/specs/list-row.spec.json +1 -0
  55. package/dist/vocabulary/specs/list.spec.json +1 -0
  56. package/dist/vocabulary/specs/loading-indicator.spec.json +1 -0
  57. package/dist/vocabulary/specs/main-action-button.spec.json +1 -0
  58. package/dist/vocabulary/specs/marquee-text.spec.json +1 -0
  59. package/dist/vocabulary/specs/menu.spec.json +1 -0
  60. package/dist/vocabulary/specs/menubar.spec.json +1 -0
  61. package/dist/vocabulary/specs/meter.spec.json +1 -0
  62. package/dist/vocabulary/specs/modal-layer.spec.json +1 -0
  63. package/dist/vocabulary/specs/navigation-bar.spec.json +1 -0
  64. package/dist/vocabulary/specs/navigation-drawer.spec.json +1 -0
  65. package/dist/vocabulary/specs/number-field.spec.json +1 -0
  66. package/dist/vocabulary/specs/number-input.spec.json +1 -0
  67. package/dist/vocabulary/specs/number-ticker.spec.json +1 -0
  68. package/dist/vocabulary/specs/one-time-code-field.spec.json +1 -0
  69. package/dist/vocabulary/specs/one-time-code-input.spec.json +1 -0
  70. package/dist/vocabulary/specs/page-header.spec.json +1 -0
  71. package/dist/vocabulary/specs/pagination.spec.json +1 -0
  72. package/dist/vocabulary/specs/popover.spec.json +1 -0
  73. package/dist/vocabulary/specs/previous-next-links.spec.json +1 -0
  74. package/dist/vocabulary/specs/progress-indicator.spec.json +1 -0
  75. package/dist/vocabulary/specs/prose.spec.json +1 -0
  76. package/dist/vocabulary/specs/radio-button.spec.json +1 -0
  77. package/dist/vocabulary/specs/radio-group.spec.json +1 -0
  78. package/dist/vocabulary/specs/rating.spec.json +1 -0
  79. package/dist/vocabulary/specs/resizable-frame.spec.json +1 -0
  80. package/dist/vocabulary/specs/scroll-area.spec.json +1 -0
  81. package/dist/vocabulary/specs/search.spec.json +1 -0
  82. package/dist/vocabulary/specs/segmented-button.spec.json +1 -0
  83. package/dist/vocabulary/specs/select-field.spec.json +1 -0
  84. package/dist/vocabulary/specs/select.spec.json +1 -0
  85. package/dist/vocabulary/specs/side-sheet.spec.json +1 -0
  86. package/dist/vocabulary/specs/size-transition.spec.json +1 -0
  87. package/dist/vocabulary/specs/skeleton.spec.json +1 -0
  88. package/dist/vocabulary/specs/slider-field.spec.json +1 -0
  89. package/dist/vocabulary/specs/slider.spec.json +1 -0
  90. package/dist/vocabulary/specs/snackbar.spec.json +1 -0
  91. package/dist/vocabulary/specs/split-view.spec.json +1 -0
  92. package/dist/vocabulary/specs/stepper.spec.json +1 -0
  93. package/dist/vocabulary/specs/steps.spec.json +1 -0
  94. package/dist/vocabulary/specs/swatch.spec.json +1 -0
  95. package/dist/vocabulary/specs/switch.spec.json +1 -0
  96. package/dist/vocabulary/specs/tab-view.spec.json +1 -0
  97. package/dist/vocabulary/specs/table-of-contents.spec.json +1 -0
  98. package/dist/vocabulary/specs/table.spec.json +1 -0
  99. package/dist/vocabulary/specs/tabs.spec.json +1 -0
  100. package/dist/vocabulary/specs/tag-group.spec.json +1 -0
  101. package/dist/vocabulary/specs/tag.spec.json +1 -0
  102. package/dist/vocabulary/specs/text-field.spec.json +1 -0
  103. package/dist/vocabulary/specs/text-input.spec.json +1 -0
  104. package/dist/vocabulary/specs/timeline.spec.json +1 -0
  105. package/dist/vocabulary/specs/toolbar.spec.json +1 -0
  106. package/dist/vocabulary/specs/tooltip.spec.json +1 -0
  107. package/dist/vocabulary/specs/tree-view.spec.json +1 -0
  108. package/dist/vocabulary/tanrei.config.json +2 -1
  109. package/dist/vocabulary/tokens/comp/accordion.tokens.json +70 -47
  110. package/dist/vocabulary/tokens/comp/app-bar.tokens.json +99 -2
  111. package/dist/vocabulary/tokens/comp/app-shell.tokens.json +1 -1
  112. package/dist/vocabulary/tokens/comp/avatar.tokens.json +17 -5
  113. package/dist/vocabulary/tokens/comp/badge.tokens.json +2 -1
  114. package/dist/vocabulary/tokens/comp/bottom-sheet.tokens.json +143 -73
  115. package/dist/vocabulary/tokens/comp/breadcrumbs.tokens.json +3 -3
  116. package/dist/vocabulary/tokens/comp/button-group.tokens.json +26 -4
  117. package/dist/vocabulary/tokens/comp/button-with-menu.tokens.json +256 -28
  118. package/dist/vocabulary/tokens/comp/button.tokens.json +275 -22
  119. package/dist/vocabulary/tokens/comp/calendar.tokens.json +28 -18
  120. package/dist/vocabulary/tokens/comp/callout.tokens.json +55 -299
  121. package/dist/vocabulary/tokens/comp/card.tokens.json +3 -3
  122. package/dist/vocabulary/tokens/comp/carousel.tokens.json +70 -10
  123. package/dist/vocabulary/tokens/comp/chat-composer.tokens.json +37 -3
  124. package/dist/vocabulary/tokens/comp/checkbox.tokens.json +18 -22
  125. package/dist/vocabulary/tokens/comp/chip.tokens.json +67 -16
  126. package/dist/vocabulary/tokens/comp/code-block.tokens.json +15 -1
  127. package/dist/vocabulary/tokens/comp/combobox.tokens.json +202 -33
  128. package/dist/vocabulary/tokens/comp/copy-button.tokens.json +19 -2
  129. package/dist/vocabulary/tokens/comp/date-time-picker.tokens.json +66 -35
  130. package/dist/vocabulary/tokens/comp/description-list.tokens.json +45 -23
  131. package/dist/vocabulary/tokens/comp/dialog.tokens.json +95 -35
  132. package/dist/vocabulary/tokens/comp/drop-zone.tokens.json +151 -0
  133. package/dist/vocabulary/tokens/comp/embedded-text-input.tokens.json +2 -2
  134. package/dist/vocabulary/tokens/comp/field-group.tokens.json +21 -1
  135. package/dist/vocabulary/tokens/comp/field.tokens.json +33 -4
  136. package/dist/vocabulary/tokens/comp/figure.tokens.json +56 -2
  137. package/dist/vocabulary/tokens/comp/file-item.tokens.json +4 -4
  138. package/dist/vocabulary/tokens/comp/file-picker.tokens.json +3 -3
  139. package/dist/vocabulary/tokens/comp/file-upload.tokens.json +2 -7
  140. package/dist/vocabulary/tokens/comp/handle.tokens.json +343 -0
  141. package/dist/vocabulary/tokens/comp/image-preview.tokens.json +53 -23
  142. package/dist/vocabulary/tokens/comp/input-box.tokens.json +161 -26
  143. package/dist/vocabulary/tokens/comp/keyboard-shortcut.tokens.json +5 -3
  144. package/dist/vocabulary/tokens/comp/link-card.tokens.json +24 -4
  145. package/dist/vocabulary/tokens/comp/link.tokens.json +3 -3
  146. package/dist/vocabulary/tokens/comp/list-row.tokens.json +249 -0
  147. package/dist/vocabulary/tokens/comp/list.tokens.json +106 -225
  148. package/dist/vocabulary/tokens/comp/loading-indicator.tokens.json +13 -3
  149. package/dist/vocabulary/tokens/comp/main-action-button.tokens.json +96 -23
  150. package/dist/vocabulary/tokens/comp/marquee-text.tokens.json +110 -0
  151. package/dist/vocabulary/tokens/comp/menu.tokens.json +248 -43
  152. package/dist/vocabulary/tokens/comp/menubar.tokens.json +63 -12
  153. package/dist/vocabulary/tokens/comp/meter.tokens.json +173 -0
  154. package/dist/vocabulary/tokens/comp/modal-layer.tokens.json +69 -0
  155. package/dist/vocabulary/tokens/comp/navigation-bar.tokens.json +5 -36
  156. package/dist/vocabulary/tokens/comp/navigation-drawer.tokens.json +478 -122
  157. package/dist/vocabulary/tokens/comp/number-input.tokens.json +2 -2
  158. package/dist/vocabulary/tokens/comp/number-ticker.tokens.json +77 -0
  159. package/dist/vocabulary/tokens/comp/one-time-code-input.tokens.json +22 -7
  160. package/dist/vocabulary/tokens/comp/pagination.tokens.json +118 -79
  161. package/dist/vocabulary/tokens/comp/popover.tokens.json +84 -13
  162. package/dist/vocabulary/tokens/comp/previous-next-links.tokens.json +194 -0
  163. package/dist/vocabulary/tokens/comp/progress-indicator.tokens.json +14 -4
  164. package/dist/vocabulary/tokens/comp/prose.tokens.json +16 -0
  165. package/dist/vocabulary/tokens/comp/radio-button.tokens.json +16 -20
  166. package/dist/vocabulary/tokens/comp/rating.tokens.json +230 -0
  167. package/dist/vocabulary/tokens/comp/resizable-frame.tokens.json +166 -0
  168. package/dist/vocabulary/tokens/comp/scroll-area.tokens.json +99 -0
  169. package/dist/vocabulary/tokens/comp/search.tokens.json +144 -58
  170. package/dist/vocabulary/tokens/comp/segmented-button.tokens.json +75 -21
  171. package/dist/vocabulary/tokens/comp/select.tokens.json +168 -34
  172. package/dist/vocabulary/tokens/comp/side-sheet.tokens.json +60 -13
  173. package/dist/vocabulary/tokens/comp/size-transition.tokens.json +49 -0
  174. package/dist/vocabulary/tokens/comp/skeleton.tokens.json +5 -2
  175. package/dist/vocabulary/tokens/comp/slider.tokens.json +11 -10
  176. package/dist/vocabulary/tokens/comp/snackbar.tokens.json +81 -255
  177. package/dist/vocabulary/tokens/comp/split-view.tokens.json +52 -0
  178. package/dist/vocabulary/tokens/comp/stepper.tokens.json +538 -0
  179. package/dist/vocabulary/tokens/comp/swatch.tokens.json +208 -0
  180. package/dist/vocabulary/tokens/comp/switch.tokens.json +19 -18
  181. package/dist/vocabulary/tokens/comp/tab-view.tokens.json +5 -5
  182. package/dist/vocabulary/tokens/comp/table-of-contents.tokens.json +58 -33
  183. package/dist/vocabulary/tokens/comp/table.tokens.json +141 -30
  184. package/dist/vocabulary/tokens/comp/tabs.tokens.json +132 -44
  185. package/dist/vocabulary/tokens/comp/tag-group.tokens.json +15 -4
  186. package/dist/vocabulary/tokens/comp/tag.tokens.json +32 -8
  187. package/dist/vocabulary/tokens/comp/text-input.tokens.json +18 -88
  188. package/dist/vocabulary/tokens/comp/timeline.tokens.json +15 -19
  189. package/dist/vocabulary/tokens/comp/toolbar.tokens.json +121 -6
  190. package/dist/vocabulary/tokens/comp/tooltip.tokens.json +8 -32
  191. package/dist/vocabulary/tokens/comp/tree-view.tokens.json +136 -51
  192. package/dist/vocabulary/tokens/dial/dial.tokens.json +23 -3
  193. package/dist/vocabulary/tokens/fidelity/cupertino.fidelity.json +165 -0
  194. package/dist/vocabulary/tokens/fidelity/m3-like.fidelity.json +215 -5
  195. package/dist/vocabulary/tokens/fidelity/reference/androidx-material3.json +144 -0
  196. package/dist/vocabulary/tokens/fidelity/reference/apple-hig.json +196 -0
  197. package/dist/vocabulary/tokens/generated/cupertino/components.json +1749 -0
  198. package/dist/vocabulary/tokens/generated/cupertino/fidelity.json +162 -0
  199. package/dist/vocabulary/tokens/generated/m3-like/components.json +1761 -0
  200. package/dist/vocabulary/tokens/generated/m3-like/fidelity.json +182 -12
  201. package/dist/vocabulary/tokens/generated/tanrei/components.json +1764 -0
  202. package/dist/vocabulary/tokens/icon-sets/material-symbols.icon-set.json +2 -1
  203. package/dist/vocabulary/tokens/schema/system.schema.json +324 -35
  204. package/dist/vocabulary/tokens/sys/behavior.tokens.json +66 -1
  205. package/dist/vocabulary/tokens/sys/measure.tokens.json +105 -21
  206. package/dist/vocabulary/tokens/sys/motion.tokens.json +474 -2
  207. package/dist/vocabulary/tokens/sys/scroll-edge.tokens.json +50 -0
  208. package/dist/vocabulary/tokens/sys/shape.tokens.json +1 -1
  209. package/dist/vocabulary/tokens/sys/state.tokens.json +16 -3
  210. package/dist/vocabulary/tokens/sys/typescale.tokens.json +5 -5
  211. package/dist/vocabulary/tokens/systems/core.system.json +1889 -0
  212. package/dist/vocabulary/tokens/systems/cupertino.system.json +298 -79
  213. package/dist/vocabulary/tokens/{comp → systems/m3-like/comp}/fab-menu.tokens.json +5 -15
  214. package/dist/vocabulary/tokens/systems/m3-like.system.json +451 -125
  215. package/dist/vocabulary/tokens/systems/tanrei.system.json +619 -321
  216. package/dist/vocabulary/tokens/tanrei.resolver.json +48 -6
  217. package/package.json +22 -6
  218. package/dist/vocabulary/tokens/AGENTS.md +0 -15
  219. package/dist/vocabulary/tokens/comp/navigation-rail.tokens.json +0 -254
  220. package/dist/vocabulary/tokens/fidelity/m3-expressive-like.fidelity.json +0 -68
  221. package/dist/vocabulary/tokens/fidelity/reference/androidx-material3-buttons.json +0 -67
  222. package/dist/vocabulary/tokens/generated/m3-expressive-like/fidelity.json +0 -99
  223. package/dist/vocabulary/tokens/systems/m3-expressive-like.system.json +0 -83
  224. package/dist/vocabulary/tokens/vocabulary.lock.json +0 -7052
@@ -0,0 +1 @@
1
+ {"name":"button-with-menu","title":"Button with menu","summary":"Performs a main action with one press, and reveals more options for it in a menu from a second button joined to it.","level":"composed","listing":"default","builtFrom":["menu"],"anatomy":[{"id":"leading","description":"The leading half: a button that performs the main action. It holds the optional icon and the label, and carries its own hover, focus and press."},{"id":"trailing","description":"The trailing half: a button that opens and closes the menu of more options. It holds the chevron and carries its own hover, focus and press, at its default width or a narrow one. With hoverOpen on, a fine pointer resting on it opens the menu too."},{"id":"container","description":"Each half's shape: its fill, outline, elevation and corners. The halves share one look (the destructive one too, SPB-34) and are joined by a divider or by a narrow gap (separation): round outer ends, and under gap tighter corners where they face each other. The trailing half keeps its shape while the menu is open in the default system."},{"id":"icon","description":"A glyph before the label in the leading half, drawn in the label color; the padding on its side is a step tighter than without it, as Button's.","optional":true},{"id":"label","description":"The leading half's text and its accessible name."},{"id":"chevron","description":"The trailing half's glyph. By default it is the icon set's expand_more, turned half a turn while the menu is open. The chevron slot replaces it, and the chevron-open slot gives the trailing half a different glyph while the menu is open."},{"id":"divider","description":"Under divider, the line on the seam where the two halves touch. Under gap there is none.","optional":true},{"id":"menu","description":"The Tanrei Menu the trailing half opens, anchored to the whole button with menu. It keeps its own tokens and behaviour."},{"id":"focus-ring","description":"Gap-then-ring indicator shown for keyboard focus, around whichever half has it."}],"props":[{"name":"variant","type":"enum","values":["filled","tonal","elevated","outlined"],"axis":"tanrei.comp.button-with-menu.variant","default":"filled","description":"Emphasis, as Button's variants of the same names. A design system may add values."},{"name":"destructive","type":"boolean","default":false,"description":"Marks a main action that deletes or discards something a person may not get back (Delete, with Delete all in the menu): both halves keep their variant's emphasis and take the error role's color in it, as a destructive Button of the same variant does (SPB-34). Use it for that kind of action alone, never for emphasis. It adds a color, not a meaning: the label still says what the action does (SPB-35). The menu's items are not marked by it: an item that deletes carries its own destructive."},{"name":"size","type":"enum","values":["small","medium","large"],"axis":"tanrei.comp.button-with-menu.size","default":"medium","description":"Visual height: comp.button-with-menu.container.height.<size>, matching Button's heights and its hit area never below sys.target.minimum (28 / 36 / 52 under the default system, the small one drawn at its step). The hit area always meets the minimum target. While it is not set the button with menu is drawn at the size its nearest container sets — a toolbar's size (SPB-37) — and at medium where none does. A design system may add values."},{"name":"separation","type":"enum","values":["auto","divider","gap"],"default":"auto","description":"How the two halves are joined. divider: they touch, and a line is drawn on the seam. gap: they stand a narrow gap apart, with tighter corners where they face each other. Auto takes comp.button-with-menu.container.separation, the design system's answer (divider in the default system). The halves always sit side by side: there is no vertical form."},{"name":"trailingWidth","type":"enum","values":["default","narrow"],"default":"default","description":"How wide the trailing half is. default holds the chevron in a square of the height (28 / 36 / 52 under the default system); narrow makes the half a slim handle on the main action: the chevron with a small inset on each side, and the padding at the rounded outer end (32 / 36 / 36), as the default width takes it too. The hit area meets the minimum target at both."},{"name":"fullWidth","type":"boolean","default":false,"description":"Makes the button with menu take the whole width its container gives it, at the height of its size (SPB-38): the leading half takes the extra width, its content centred as a full-width Button's is, and the trailing half keeps the width trailingWidth gives it. For a form's only action on a narrow screen, the action at the foot of a card or a sheet. Ignored while a toolbar lays the button with menu out, which gives it a width of its own."},{"name":"label","type":"string","default":"","description":"The leading half's visible text and accessible name (\"Save\"). Required."},{"name":"menuLabel","type":"string","default":"","description":"The trailing half's accessible name (\"More save options\"). Required: the chevron alone is not a name."},{"name":"open","type":"boolean","default":false,"description":"Whether the menu is shown. Where open is a plain value (web, Compose, React Native) the product sets it from toggle and sets it to false from close; where it is a binding or a controller (SwiftUI, Flutter) the button with menu opens and closes the menu through it (SPB-2, SPB-16)."},{"name":"disabled","type":"boolean","default":false,"description":"Prevents interaction with both halves and removes them from the focus order."},{"name":"busy","type":"boolean","default":false,"description":"The main action it started is under way: the leading half keeps its focus, its place in the focus order and its size, draws the loading indicator's arc in place of its label and icon, refuses every activation, and tells assistive technology through busyLabel, as a busy Button does (SPB-39, SPB-40). The trailing half and its menu stay as they are, so the related actions are still one press away. For a save or a send that takes a moment; it is not disabled, so focus stays where the person left it."},{"name":"busyLabel","type":"string","default":"","description":"What assistive technology is told while the button with menu is busy (\"Saving\"): announced once when it becomes busy and read after the leading half's name while it is. Tanrei ships no words of its own. Required while busy is true; ignored otherwise.","words":"busyLabel"},{"name":"hoverOpen","type":"boolean","default":false,"description":"Also opens the menu when a fine pointer rests on the trailing half for hoverDelay, and closes that menu when the pointer leaves the trailing half and the menu (SPB-22 to SPB-25). A press and the keyboard still open it as without. Never applies to touch."},{"name":"hoverDelay","type":"number","default":null,"description":"How long, in milliseconds, a fine pointer rests on the trailing half before the menu opens on hover. Null takes comp.button-with-menu.motion.hover-open-delay. Ignored unless hoverOpen is true."}],"slots":[{"name":"icon","description":"The leading half's icon (a glyph of the system's icon set).","fixture":"glyph"},{"name":"chevron","description":"The trailing half's glyph in place of expand_more (one glyph of the system's icon set). Alone, it is turned half a turn while the menu is open, as the default is; with chevron-open it is the closed form only (SPB-21).","fixture":"glyph"},{"name":"chevron-open","description":"The trailing half's glyph while the menu is open (one glyph of the system's icon set). When it is filled, the trailing half cross-fades between the closed glyph and this one instead of turning (SPB-21).","fixture":"glyph"},{"name":"menu","description":"The menu's content: the menu's own item kinds (item, checkbox-item, radio-item and group, as the menu spec defines them), which the button with menu presents in a Tanrei Menu. Fixtures cannot fill it (SPB-15)."}],"events":[{"name":"click","description":"The leading half was activated by pointer, touch, keyboard or assistive technology."},{"name":"toggle","description":"The trailing half asks to open or close the menu: by a press or a key on it (SPB-2), or, with hoverOpen on, by a fine pointer resting on it or leaving it and the menu (SPB-22, SPB-23). Carries the open value it asks for."},{"name":"close","description":"The menu asks to be closed; carries the menu's reason: escape, back, outside, tab, focus-out, item or anchor-hidden (in the platform's casing); anchor-hidden when the button with menu is no longer drawn while its menu is open (MNU-65)."}],"states":["enabled","disabled","hovered","focused","pressed","loading"],"behavior":[{"id":"SPB-1","text":"WHEN the user activates the leading half by pointer, touch, Enter or Space THE button with menu SHALL emit click exactly once, and SHALL NOT open or close the menu."},{"id":"SPB-2","text":"WHEN the user activates the trailing half by pointer, touch, Enter or Space THE button with menu SHALL emit toggle exactly once with the opposite of open, and WHEN the user presses Down Arrow on the trailing half while open is false it SHALL emit toggle with true; the menu SHALL then open or close through open: through its binding or controller where open is one (SwiftUI, Flutter), and by the product setting open where open is a plain value (web, Compose, React Native). A menu that is open from hover is the exception: activating the trailing half then keeps it open and emits no toggle (SPB-24)."},{"id":"SPB-3","text":"WHILE disabled is true THE button with menu SHALL NOT emit click, toggle or close, SHALL NOT make either half focusable, SHALL expose the disabled state on both halves and SHALL present no menu, whatever open says; it SHALL NOT open the menu on hover, whatever hoverOpen says."},{"id":"SPB-4","text":"WHILE a half is hovered, keyboard-focused or pressed THE button with menu SHALL render that half's container, label, icon or chevron, outline, elevation and opacity from the component tokens of its variant in that half's highest-precedence active state, with precedence pressed over focused over hovered, and SHALL keep the other half at its own state (neither half is hovered or pressed while the pointer or the press is on the other); focus gained by pointer or touch SHALL NOT select the focused state."},{"id":"SPB-5","text":"WHEN a half receives keyboard focus THE button with menu SHALL show the focus ring around that half's own shape, without animation; focus gained by pointer or touch SHALL NOT show it."},{"id":"SPB-6","text":"WHERE a half is smaller than the minimum target THE button with menu SHALL extend that half's hit area on both axes to sys.target.touch for touch input and sys.target.pointer for fine pointers without changing its visual size — above and below, and outward past the button with menu's start edge for the leading half and past its end edge for the trailing half — and toward the other half no further than the middle of the gap between them, or the seam where they touch, so that the two never overlap; a narrow trailing half SHALL reach its target the same way and SHALL NOT be drawn wider for it; a platform that cannot tell the input type SHALL use sys.target.touch."},{"id":"SPB-7","text":"WHILE disabled is true THE button with menu SHALL render both halves' containers, label, icon, chevron, outline, elevation and opacity from the disabled component tokens of its variant. A disabled button with menu SHALL draw its closed form (the trailing half's closed shape and the closed chevron: the chevron slot's glyph, or expand_more when that slot is empty, unturned), whatever open says."},{"id":"SPB-8","text":"WHEN variant or size names a value that the active design system does not have THE button with menu SHALL render with the default value's tokens, and WHEN separation or trailingWidth names a value it does not define THE button with menu SHALL render with that prop's default (auto, default); in debug builds it SHALL report the unknown value."},{"id":"SPB-9","text":"WHEN a half of the button with menu is pressed by pointer, touch, Enter or Space THE half SHALL show the pressed state without delay and SHALL keep it visible for at least sys.motion.duration.press-hold, even when the press ends sooner."},{"id":"SPB-10","text":"WHILE pressed THE half SHALL answer as sys.behavior.pressed-feedback names: overlay applies the pressed tokens to the whole container at once; ripple grows the pressed state layer from the point of contact (from the center for keyboard activation); dim applies the pressed opacity to the whole control and draws no state layer; none draws no answer to the press. Under ripple and dim only the container color stays with the state under the press; label, icon, chevron, outline, elevation, opacity and shape still come from the pressed tokens. Under none every part stays with the state under the press. The ripple grows over comp.button-with-menu.motion.feedback-duration with comp.button-with-menu.motion.state-easing, fades over comp.button-with-menu.motion.state-duration with comp.button-with-menu.motion.state-easing once the press has ended and press-hold has passed, and appears whole where motion is reduced."},{"id":"SPB-11","text":"THE half SHALL ease its container corners by sys.shape.corner-smoothing (0 is a quarter circle, 0.6 the iOS continuous corner; a platform with only the OS curve draws it for any amount above 0) and show its keyboard focus as sys.behavior.focus-style names (ring or glow); a platform that cannot draw a choice SHALL fall back to the first value and state that in its README."},{"id":"SPB-12","text":"THE button with menu SHALL draw its two halves in one row, joined as its separation names (SPB-30): the leading half at least the height of its size (comp.button-with-menu.container.height.medium for medium, and so on) and as wide as its content, holding its icon, when it has one, and then its label, comp.button-with-menu.container.gap.medium apart, padded at the start by comp.button-with-menu.leading.padding-inline-start-with-icon.medium when it has an icon and by comp.button-with-menu.leading.padding-inline-start.medium when it has none, at the end by comp.button-with-menu.leading.padding-inline-end.medium, and above and below by at least comp.button-with-menu.container.padding-block.medium; and the trailing half as tall as the leading half, holding the chevron centred between comp.button-with-menu.trailing.padding-inline.medium on each side WHILE trailingWidth is default and between comp.button-with-menu.trailing.padding-inline-narrow.medium on each side WHILE trailingWidth is narrow (and so on for each size). Each half SHALL then take the outer padding of SPB-32. THE button with menu SHALL NOT stack its halves: it has no vertical form."},{"id":"SPB-13","text":"THE button with menu SHALL round the leading half's start corners and the trailing half's end corners by comp.button-with-menu.container.shape, capped at half that half's height (so that the default system's sys.shape.corner.full draws round ends) and eased by sys.shape.corner-smoothing. WHILE its separation is gap it SHALL round the corners where the halves face each other by comp.button-with-menu.container.inner-shape and, WHILE open is true, the trailing half's by comp.button-with-menu.container.inner-shape-open, each capped and eased the same way; WHILE its separation is divider those corners SHALL be square, open or not. WHILE open is true the chevron SHALL show its open form (SPB-21). WHEN open changes THE button with menu SHALL change the chevron, and the trailing half's inner corners where the two tokens differ, over comp.button-with-menu.motion.open-duration with comp.button-with-menu.motion.open-easing, and at once where motion is reduced. THE button with menu SHALL NOT change the shape of a half for any other reason: where comp.button-with-menu.container.inner-shape-open has the value of comp.button-with-menu.container.inner-shape, as in the default system, the trailing half keeps its shape while the menu is open and the chevron alone shows it. Each half SHALL clip its fill, state layer and ripple to its own shape, and draw its outline and its elevation's ring as SPB-26 says."},{"id":"SPB-14","text":"THE button with menu SHALL set the label in the text style of its size (comp.button-with-menu.label.typescale.medium, and so on) and the label color of its variant and the leading half's state (comp.button-with-menu.filled.label.color for filled at rest, and so on), SHALL NOT truncate it (it stays on one line while it fits, wraps when the layout gives it less width, and the halves grow in height with it), and SHALL draw the icon and the chevron (expand_more, or a chevron slot's glyph, SPB-21) at the icon size of its size (comp.button-with-menu.icon.size.medium, and so on) through the icon helper, each in the label color of its own half's state, with the family and fill of an unselected icon, sys.icon.weight, and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max."},{"id":"SPB-15","text":"WHEN open becomes true THE button with menu SHALL present the items of its menu slot as a Tanrei Menu, which then behaves as MNU-1 to MNU-29 say, anchored to the whole button with menu with placement bottom-end (below it with the end edges aligned, flipping as MNU-2 says), with the trailing half as the element focus returns to when the menu closes: an operated overlay that is not modal, as the menu is; a menu that opens from hover SHALL NOT take focus (SPB-22). WHEN open becomes false THE button with menu SHALL remove the menu."},{"id":"SPB-16","text":"WHEN the menu asks to be closed (MNU-5, MNU-6) THE button with menu SHALL emit close once with the menu's reason and SHALL be closed: through its binding or controller where open is one (SwiftUI, Flutter), and by the product setting open to false where open is a plain value (web, Compose, React Native); WHEN an action item of the menu is activated THE button with menu SHALL let the item emit its click first and then emit close with the reason item. A press on the trailing half while the menu is open is not a press outside: it SHALL emit toggle with false (SPB-2), or keep a menu that is open from hover open (SPB-24), and emit no close."},{"id":"SPB-17","text":"THE button with menu SHALL expose two buttons in reading order, each its own Tab stop: the leading half named by label, and the trailing half named by menuLabel, exposing that it opens a menu and whether the menu is open where the platform has those properties, however it opened, and WHILE the menu is open which element it is — naming nothing WHILE it is closed, as MNU-24 says; the icon and the chevron (expand_more or a chevron slot's glyph) SHALL be hidden, and the button with menu SHALL expose no element of its own around them."},{"id":"SPB-18","text":"THE button with menu SHALL cast the blurred layers of each half's elevation, of its variant and that half's state (comp.button-with-menu.elevated.container.elevation for elevated at rest, and so on), outside that half without clipping them, and draw the elevation's ring inside the half (SPB-26); WHEN the elevation or the colors of a half change between states THE button with menu SHALL animate the change over comp.button-with-menu.motion.state-duration with comp.button-with-menu.motion.state-easing, changing them at once where motion is reduced."},{"id":"SPB-19","text":"WHEN the layout direction is right-to-left THE button with menu SHALL put the trailing half on the left, mirror the order of the leading half's icon and label and apply its paddings by logical start and end, SHALL present its menu with the end edges aligned at the left (the menu's left edge on the button with menu's left edge, below the trailing half: SPB-15 and MNU-2), SHALL NOT mirror the chevron expand_more or change the way it turns, SHALL leave a glyph of the icon slot or of a chevron slot to the icon helper (SPB-28), and SHALL grow a ripple from the point of contact as in left-to-right."},{"id":"SPB-20","text":"WHILE label is not empty THE button with menu SHALL expose it as the leading half's accessible name, over a name the product gives it on the element (aria-label or aria-labelledby). WHILE label is empty and the product gives the button with menu a name of its own on the element — aria-label, or aria-labelledby naming an element — THE button with menu SHALL expose that name as the leading half's accessible name. WHILE label is empty and the product gives it none, or menuLabel is empty, THE button with menu SHALL still render, and in debug builds report the half that has no accessible name; WHILE the menu slot holds no item THE button with menu SHALL still emit toggle and draw the trailing half's open form, SHALL present no menu, and in debug builds report the empty menu."},{"id":"SPB-21","text":"WHILE neither the chevron slot nor the chevron-open slot holds a glyph THE button with menu SHALL draw the icon set's expand_more as the chevron, turned half a turn while open is true; WHILE only the chevron slot holds a glyph THE button with menu SHALL draw that glyph in its place, turned the same way; WHILE the chevron-open slot holds a glyph THE button with menu SHALL draw it unturned while open is true and, while open is false, the chevron slot's glyph (or expand_more when that slot is empty) unturned, and WHEN open changes SHALL cross-fade from one to the other instead of turning. Each slot SHALL hold at most one glyph: the button with menu SHALL draw the first and in debug builds report the rest."},{"id":"SPB-22","text":"WHERE hoverOpen is true, WHEN a fine pointer (a mouse, a trackpad, or a pen that hovers) enters the trailing half while open is false and stays on it for hoverDelay milliseconds, or for comp.button-with-menu.motion.hover-open-delay when hoverDelay is null, THE button with menu SHALL emit toggle with true once, and WHEN open then becomes true the menu SHALL be open from hover: THE button with menu SHALL present it without moving focus into it (in place of MNU-1's move to the first item), focus staying where it was, and a pointer on an item SHALL render the item hovered without moving focus to it (in place of MNU-8). The pointer leaving the trailing half before the delay has passed, a press on either half, or open becoming true by other means SHALL cancel the wait. Touch, and pointer events a platform synthesises from touch, SHALL never open the menu on hover. WHERE hoverDelay is negative or not a number THE button with menu SHALL wait for comp.button-with-menu.motion.hover-open-delay, and in debug builds report the value."},{"id":"SPB-23","text":"WHILE the menu is open from hover, WHEN the pointer has been off both the trailing half and the menu's surface for comp.button-with-menu.motion.hover-close-delay THE button with menu SHALL emit toggle with false once and SHALL NOT move focus; a pointer that comes back onto either within that time SHALL keep the menu open, and a press outside both SHALL close it as MNU-5 says. WHILE the menu is open for any other reason (a press, a key, or the product setting open) THE button with menu SHALL NOT close it when the pointer leaves."},{"id":"SPB-24","text":"WHEN the user activates the trailing half by pointer, touch, Enter, Space or Down Arrow while the menu is open from hover THE button with menu SHALL NOT emit toggle, SHALL keep the menu open and SHALL move focus to its first enabled item as MNU-1 says; from then on the menu SHALL be open as if that activation had opened it: the pointer leaving no longer closes it (SPB-23), MNU-8 applies again, and the next activation of the trailing half emits toggle with false (SPB-2)."},{"id":"SPB-25","text":"WHILE the menu is open from hover, WHEN the user presses Escape or the platform's back, wherever focus is, THE button with menu SHALL emit close once with the reason escape or back, SHALL be closed as SPB-16 says, SHALL NOT move focus, and SHALL keep that key from reaching anything else, so that what hover showed can be dismissed without moving the pointer (WCAG 1.4.13); a later Escape reaches the page as usual."},{"id":"SPB-26","text":"THE button with menu SHALL draw each half's outline (comp.button-with-menu.outline.width.medium wide at the medium size, and so on, in the outline color of its variant and that half's state) and the ring of its elevation (the layer with no offset, no blur and a positive spread, which the default system gives every level above sys.elevation.level0 and which a platform otherwise draws as a border) inside that half's own edge, the outline over the ring. WHILE its separation is gap neither SHALL reach into the comp.button-with-menu.container.inner-gap between the halves, so that the two halves' edges never meet, however narrow that gap is; WHILE its separation is divider each half SHALL draw neither along the edge where the halves touch, so that the outline and the ring run once around the joined shape and the divider (SPB-31) is the only line on the seam. Only the elevation's blurred layers SHALL fall outside a half (SPB-18)."},{"id":"SPB-27","text":"THE button with menu SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the button with menu is shown THE button with menu SHALL draw itself for the new direction at once, without a motion of its own, keeping its open state and its focus, an open menu placed again by the new direction."},{"id":"SPB-28","text":"WHERE the layout direction is right-to-left THE button with menu SHALL draw the glyph of its icon slot and a glyph of its chevron or chevron-open slot mirrored left to right exactly when the system's icon set marks that glyph's name as mirrored or the product forces mirroring for that use, and unmirrored when the product forbids it: the icon helper mirrors the glyph inside its own box, about the box's vertical centre line, changing neither its place, size, color and fill nor the order SPB-19 gives. THE button with menu SHALL NOT mirror a glyph itself, and SHALL NOT mirror content the product gives as an image or a view of its own rather than by a glyph's name. The chevron it draws itself (expand_more) is not marked and is never mirrored, and a mirrored chevron-slot glyph is turned while open as an unmirrored one is (SPB-21)."},{"id":"SPB-29","text":"THE button with menu SHALL lay out its label as text of its own direction, isolated from the text around it: each takes the base direction of its first strong character, or the layout direction where it has none, so that a left-to-right word, a number with its sign or unit, a telephone number and an address keep their own order in a right-to-left layout and reorder nothing beside them; THE button with menu SHALL still place the label and align its lines by the layout direction, not by the text's own."},{"id":"SPB-30","text":"THE button with menu SHALL join its two halves as its separation names: WHILE separation is auto, as comp.button-with-menu.container.separation names, which follows sys.behavior.separation unless a design system sets it apart; WHILE separation is divider or gap, as that value names, whatever the tokens say. Under gap the halves SHALL stand comp.button-with-menu.container.inner-gap apart with nothing drawn between them and the inner corners of SPB-13; under divider the halves SHALL touch, with square inner corners and the divider of SPB-31 on the seam. WHEN separation, or the token it follows, changes THE button with menu SHALL draw the other form at once, without animation, keeping its open state and its focus. A platform that cannot draw a choice SHALL fall back to the first value, divider, and state that in its README."},{"id":"SPB-31","text":"WHILE its separation is divider THE button with menu SHALL draw on the seam between its halves one line comp.button-with-menu.divider.thickness thick, in the divider color of its variant (comp.button-with-menu.filled.divider.color for filled at rest, and so on), centred on the seam, over the halves' fills and state layers, from comp.button-with-menu.divider.inset below the top of the seam to the same distance above its bottom. The line SHALL take no space of its own, SHALL NOT take a press (a press on it goes to the half under the point), SHALL NOT be exposed to assistive technology, and SHALL keep its resting color while either half is hovered, focused or pressed; WHILE disabled is true it SHALL take the disabled divider color of its variant. A half's state layer, ripple and focus ring SHALL still follow that half's own shape."},{"id":"SPB-32","text":"THE button with menu SHALL add comp.button-with-menu.container.outer-inset to the leading half's start padding, under either separation and at either trailing width, and to the trailing half's end padding, under either separation and at either trailing width, so that content beside a rounded outer end looks as far from it as from the tighter corner on its other side: the leading half SHALL be wider by that amount with its icon and label moved inward by it, and the trailing half SHALL be wider by that amount with its chevron centred in what is left, half of it nearer the leading half. WHILE trailingWidth is narrow THE trailing half SHALL be as wide as the chevron's box, comp.button-with-menu.trailing.padding-inline-narrow.medium on each side of it (of its own size) and the outer padding, with the chevron centred in what is left: a slim half beside a full end needs the compensation as much as a wide one, its chevron being nearer the curve, so it is one outer padding wider than a narrow icon-only Button of its size (BTN-12) where the two components' tokens agree, as in the default system. In a right-to-left layout the start is the right, as SPB-19 says."},{"id":"SPB-33","text":"WHERE the component that places the button with menu keeps one Tab stop among its items and makes each half a stop of its own (a toolbar, TBR-25), through the internal channel a Button reads from the component that places it (BTN-10), THE button with menu SHALL let that component say which half, if either, is its Tab stop and move focus to either half, SHALL take the other half out of the Tab order while it does, and SHALL keep each half's own name, role, state, keys and activation. WHILE no component does so THE button with menu SHALL keep both halves in the Tab order, as SPB-17 says. It adds nothing to the public surface: no prop, attribute or styling property says which half is a stop."},{"id":"SPB-34","text":"WHILE destructive is true THE button with menu SHALL render both halves' containers, label, icon, chevron and outline, and the divider, from the destructive parts of its variant (comp.button-with-menu.filled.destructive.container.color, and so on for each variant), each half in its own state from the destructive parts of that state, and its elevation, shape and opacity as it would without destructive; WHILE destructive is false it SHALL render from the variant's own parts. In every shipped system the destructive parts are those of a destructive Button of the same variant (BTN-40) — filled: the error color with the on-error color on it; tonal: the error container with the on-error-container color on it; elevated and outlined: the variant's own container with the label, the icon and the chevron in the error color, and an outlined half's edge and divider in it too — and disabled they are those of the variant's plain disabled look, so that a disabled destructive button with menu looks like any disabled button with menu of its variant. THE button with menu SHALL NOT pass destructive to the items of its menu: an item is drawn destructive by its own destructive alone (MNU-18), since an option of the menu may delete where the main action does not, and the reverse."},{"id":"SPB-35","text":"THE button with menu SHALL NOT make color the only sign that its main action is destructive: WHILE destructive is true it SHALL keep both halves' roles, accessible names, states and keyboard behaviour exactly as they are without it, and SHALL expose nothing more to assistive technology on the web, where no role or state says it; WHERE the platform has a destructive role of its own (SwiftUI's ButtonRole.destructive) THE button with menu SHALL give it to the leading half, whose press performs the action, and not to the trailing half, which only opens the menu. Its label says what it destroys."},{"id":"SPB-36","text":"WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE button with menu SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the element that carries its role (the leading half carries them) — an id reference by the elements it names in the host's tree or a tree around it, an error message as part of the description while the button with menu is invalid — except those the button with menu owns (aria-haspopup, aria-expanded, aria-controls, aria-disabled), which it SHALL move and not expose. WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE button with menu SHALL take it off that element. WHEN the product sets an aria- attribute the button with menu owns THE button with menu SHALL report it in debug builds."},{"id":"SPB-37","text":"WHILE size is not set and a container around the button with menu sets a size for what it holds — a toolbar's size (TBR-31), the nearest such container where several do — THE button with menu SHALL draw both halves at that size, their heights following the system's height ladder as at a size of its own, and at its nearest size where it has none of that name, in the order extra-small, small, medium, large, extra-large, the larger of two as near; a container whose size is not set SHALL pass none. WHILE size is set THE button with menu SHALL be drawn at its own size, whatever a container sets. WHEN the size it takes changes — a container's size set, changed or removed, its own size set or removed, or the button with menu moved into or out of such a container — THE button with menu SHALL be drawn at the size it now takes at once."},{"id":"SPB-38","text":"WHILE fullWidth is true and no toolbar lays the button with menu out THE button with menu SHALL take the whole inline size its container gives it and SHALL give all of it beyond what the two halves need to the leading half, the trailing half keeping the width trailingWidth gives it (SPB-12, SPB-32), as the leading button of a split button takes the room its trailing button leaves; both halves SHALL keep the height, the paddings, the corners, the outline, the separation and the minimum target of their size, variant and state, and the leading half SHALL centre its content in its own width — the icon and the label as one row, in the order and at the gap SPB-12 gives them — as a full-width Button centres its content (BTN-39). WHERE the leading half is then narrower than the label THE button with menu SHALL wrap the label, its lines centred, rather than truncate it or draw past its container. WHILE a toolbar lays the button with menu out THE button with menu SHALL take the width the toolbar gives it and ignore fullWidth."},{"id":"SPB-39","text":"WHILE busy is true and disabled is false THE button with menu SHALL draw its leading half's container, outline, elevation and opacity from its enabled tokens (of its variant, or of its destructive parts, SPB-34), SHALL keep the leading half's label and icon in place without drawing them so that neither half's width or height changes, and SHALL draw at the centre of the leading half the loading indicator's arc (LDG-1; under reduced motion LDG-4's whole circle, its opacity easing from 1 down to comp.button-with-menu.motion.busy-pulse-floor-opacity and back once per cycle, never drawn below it) in a box of the icon size of its size (comp.button-with-menu.icon.size.medium, and so on), comp.button-with-menu.busy.indicator.thickness thick, in the leading half's label color, turning once per comp.button-with-menu.motion.busy-cycle-duration, as a busy Button draws its own (BTN-36). The leading half SHALL show neither the hovered nor the pressed state, and SHALL show the focused one. WHEN busy becomes true THE button with menu SHALL fade the leading half's label and icon out, and WHEN busy becomes false SHALL fade them back in, over comp.button-with-menu.motion.busy-fade-duration on comp.button-with-menu.motion.state-easing, a change of opacity alone in which nothing changes place or size, turned round from the opacity then drawn where busy changes again during it (MOT-2); the arc SHALL appear and go at once, and what the leading half exposes to assistive technology (SPB-40) SHALL change at once, not at the end of the fade, its name staying as it was throughout. WHERE motion is reduced THE button with menu SHALL draw the label and the icon, or stop drawing them, at once. THE trailing half, its chevron and the divider SHALL be drawn as they are without busy, each half in its own state."},{"id":"SPB-40","text":"WHILE busy is true and disabled is false THE button with menu SHALL keep the leading half's focus and its place in the focus order, SHALL NOT emit click by any means (a press, a key, assistive technology or a script's click), SHALL expose on the leading half that it cannot be activated now (on the web aria-disabled) and busyLabel as its description, read after its name, and WHEN busy becomes true SHALL have busyLabel announced once, politely, without moving focus; nothing SHALL be announced when it ends, because what the action did is the product's to say. THE trailing half SHALL keep its name, role, state, focus and keys, and SHALL emit toggle and present its menu as it does without busy (SPB-2, SPB-15, SPB-22), so that the related actions stay one press away. WHILE disabled is true busy SHALL change nothing (SPB-3, SPB-7). WHILE busy is true and busyLabel is empty THE button with menu SHALL still render and in debug builds report that its busy leading half does not say so."},{"id":"SPB-41","text":"IF the icon set cannot draw a glyph the button with menu shows yet — the glyph of its icon slot, expand_more, or the glyph of its chevron or chevron-open slot; its font is still loading or failed to load — THE button with menu SHALL draw nothing in that glyph's place, never the glyph's name as text, SHALL keep the glyph's box at its size so that nothing else moves, SHALL still draw both halves and the label and expose their names and states, and SHALL show the glyph once the icon set can draw it, without a motion."}],"accessibility":{"role":"button","keyboard":[{"keys":"Tab / Shift+Tab","action":"Moves focus to the leading half, then to the trailing half."},{"keys":"Enter or Space on the leading half","action":"Performs the main action (click)."},{"keys":"Enter, Space or Down Arrow on the trailing half","action":"Opens the menu (Enter and Space also close it); focus moves to the first enabled item. On a menu that opened on hover, keeps it open and moves focus to its first enabled item."},{"keys":"Escape (in the menu)","action":"Closes the menu and returns focus to the trailing half."},{"keys":"Escape (a menu that opened on hover)","action":"Closes the menu wherever focus is, and leaves focus where it was."}],"labeling":"The leading half is named by label, the trailing half by menuLabel, which should say what more the menu offers (\"More save options\"). The trailing half exposes that it opens a menu and whether it is open (aria-haspopup and aria-expanded on the web), however it opened. The icon and the chevron, whether the default or a slot's glyph, are decorative.","minimumTarget":true,"notes":["Two buttons, two Tab stops: the trailing half is a menu button in the WAI-ARIA sense, and the menu is the Tanrei Menu with its own keyboard (MNU-7).","The menu's items are the menu's own item kinds; their events (an item's click, a checkbox item's change, a group's change) are the menu's, and reach the product as they do from a menu anywhere.","Opening on hover is an addition for fine pointers, never a replacement: every menu that hover opens can also be opened by a press and by the keyboard, and keyboard and screen reader use is unchanged. It meets WCAG 1.4.13: the pointer can move onto the menu (the close delay), Escape dismisses it without moving the pointer, and it stays until the pointer leaves or the person dismisses it. It does not take focus, so a person typing elsewhere is not interrupted.","Text must remain readable at 200% text size: both halves grow in height together and the label never truncates.","How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves.","The divider is decoration: it is not exposed and takes no press. The two halves are two buttons whether a line or a gap is between them.","A narrow trailing half is drawn narrower than the minimum target; its hit area is not (SPB-6). Its target reaches outward past the end edge, so leave room for it there.","In the default system the outline of the outlined variant, and the divider of the outlined, tonal and elevated variants, are the hairline (the divider's color), far below 3:1 against their ground. That is within WCAG 1.4.11: the leading half is identified by its label, the trailing half by its chevron, and each half answers hover, focus and press on its own shape. The divider of the filled variant keeps the functional outline role, because a hairline cannot be seen on that fill.","destructive adds a color, never a meaning (WCAG 1.4.1, use of color): the error color tells people who see it that the main action deletes or discards something, and nothing tells a screen reader user so but the label. So the label names the action and what it acts on (\"Delete project\", not \"OK\"). Disabled, a destructive button with menu looks like any disabled one of its variant: a button that cannot be pressed does nothing.","busy is the leading half's, as a busy Button's is: it keeps focus and its place in the focus order, says that it cannot be activated now and what is under way (busyLabel, announced once), and announces nothing when it ends, so the product says what the action did. The trailing half and its menu stay usable, so the related actions are still offered; disable the menu's items that cannot run alongside the action."]},"tokens":"comp.button-with-menu","fixtures":[{"id":"filled-medium","props":{"variant":"filled","label":"Save","menuLabel":"More save options"}},{"id":"tonal-medium","props":{"variant":"tonal","label":"Save","menuLabel":"More save options"}},{"id":"elevated-medium","props":{"variant":"elevated","label":"Save","menuLabel":"More save options"}},{"id":"outlined-medium","props":{"variant":"outlined","label":"Save","menuLabel":"More save options"}},{"id":"filled-small","props":{"variant":"filled","size":"small","label":"Save","menuLabel":"More save options"}},{"id":"filled-large","props":{"variant":"filled","size":"large","label":"Save","menuLabel":"More save options"}},{"id":"filled-icon","props":{"variant":"filled","label":"Save","menuLabel":"More save options"},"slots":{"icon":"save"}},{"id":"filled-icon-small","props":{"variant":"filled","size":"small","label":"Save","menuLabel":"More save options"},"slots":{"icon":"save"}},{"id":"filled-icon-large","props":{"variant":"filled","size":"large","label":"Save","menuLabel":"More save options"},"slots":{"icon":"save"}},{"id":"filled-busy","props":{"variant":"filled","busy":true,"busyLabel":"Saving","label":"Save","menuLabel":"More save options"},"slots":{"icon":"save"}},{"id":"filled-open","props":{"variant":"filled","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"outlined-open","props":{"variant":"outlined","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"elevated-open","props":{"variant":"elevated","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"filled-disabled","props":{"variant":"filled","disabled":true,"label":"Save","menuLabel":"More save options"}},{"id":"outlined-disabled","props":{"variant":"outlined","disabled":true,"label":"Save","menuLabel":"More save options"}},{"id":"filled-chevron-custom","props":{"variant":"filled","label":"Share","menuLabel":"More share options"},"slots":{"chevron":"more_vert","chevron-open":"close"}},{"id":"filled-chevron-custom-open","props":{"variant":"filled","open":true,"label":"Share","menuLabel":"More share options"},"slots":{"chevron":"more_vert","chevron-open":"close"}},{"id":"filled-chevron-turned-open","props":{"variant":"filled","open":true,"label":"Save","menuLabel":"More save options"},"slots":{"chevron":"arrow_drop_down"}},{"id":"filled-opens-on-hover","props":{"variant":"filled","hoverOpen":true,"hoverDelay":500,"label":"Save","menuLabel":"More save options"}},{"id":"filled-divider","props":{"variant":"filled","separation":"divider","label":"Save","menuLabel":"More save options"}},{"id":"filled-gap","props":{"variant":"filled","separation":"gap","label":"Save","menuLabel":"More save options"}},{"id":"tonal-gap","props":{"variant":"tonal","separation":"gap","label":"Save","menuLabel":"More save options"}},{"id":"elevated-gap","props":{"variant":"elevated","separation":"gap","label":"Save","menuLabel":"More save options"}},{"id":"outlined-gap","props":{"variant":"outlined","separation":"gap","label":"Save","menuLabel":"More save options"}},{"id":"filled-gap-open","props":{"variant":"filled","separation":"gap","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"elevated-gap-open","props":{"variant":"elevated","separation":"gap","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"filled-gap-disabled","props":{"variant":"filled","separation":"gap","disabled":true,"label":"Save","menuLabel":"More save options"}},{"id":"filled-narrow","props":{"variant":"filled","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-narrow-small","props":{"variant":"filled","size":"small","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-narrow-large","props":{"variant":"filled","size":"large","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"outlined-narrow","props":{"variant":"outlined","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-gap-narrow","props":{"variant":"filled","separation":"gap","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-narrow-open","props":{"variant":"filled","trailingWidth":"narrow","open":true,"label":"Save","menuLabel":"More save options"}},{"id":"outlined-gap-narrow","props":{"variant":"outlined","separation":"gap","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-narrow-rtl","direction":"rtl","props":{"variant":"filled","trailingWidth":"narrow","label":"Save","menuLabel":"More save options"}},{"id":"filled-destructive","props":{"variant":"filled","destructive":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"tonal-destructive","props":{"variant":"tonal","destructive":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"elevated-destructive","props":{"variant":"elevated","destructive":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"outlined-destructive","props":{"variant":"outlined","destructive":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"filled-destructive-gap","props":{"variant":"filled","destructive":true,"separation":"gap","label":"Delete","menuLabel":"More delete options"}},{"id":"filled-destructive-narrow","props":{"variant":"filled","destructive":true,"trailingWidth":"narrow","label":"Delete","menuLabel":"More delete options"}},{"id":"filled-destructive-disabled","props":{"variant":"filled","destructive":true,"disabled":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"filled-destructive-open","props":{"variant":"filled","destructive":true,"open":true,"label":"Delete","menuLabel":"More delete options"}},{"id":"filled-full-width","props":{"variant":"filled","fullWidth":true,"label":"Save","menuLabel":"More save options"},"slots":{"icon":"save"}}],"platforms":{"web":{"status":"lagging","name":"tanrei-button-with-menu","props":{"variant":"variant","destructive":"destructive","size":"size","separation":"separation","trailingWidth":"trailingWidth","fullWidth":"fullWidth","label":"label","menuLabel":"menuLabel","open":"open","disabled":"disabled","busy":"busy","busyLabel":"busyLabel","hoverOpen":"hoverOpen","hoverDelay":"hoverDelay"},"events":{"click":"click","toggle":"toggle","close":"close"},"parts":{"leading":"leading","trailing":"trailing","container":"container","icon":"icon","label":"label","chevron":"chevron","divider":"divider","menu":"tanrei-menu surface","focus-ring":"container@focus-ring"},"notes":"`<tanrei-button-with-menu label=\"Save\" menu-label=\"More save options\" hover-open hover-delay=\"400\">` with optional glyph elements in `slot=\"icon\"`, `slot=\"chevron\"` and `slot=\"chevron-open\"` (the trailing half draws `expand_more` through the icon helper when both chevron slots are empty), and the menu's item elements (`tanrei-menu-item`, `tanrei-menu-checkbox-item`, `tanrei-menu-radio-item`, `tanrei-menu-group`) as children with `slot=\"menu\"`, which it forwards into a `tanrei-menu` in its shadow root. Only the leading half's `click` reaches listeners on the element; the trailing half fires `toggle` (a CustomEvent whose `detail.open` is the value asked for, not the popover's ToggleEvent, which does not leave the shadow root), for a press, a key or a hover alike, and the menu's close fires `close` with `detail.reason`. The product sets `open` from both. `hoverDelay` is a number of milliseconds; unset (null) takes the token. Hover opening listens for `pointerenter` / `pointerleave` with `pointerType` `mouse` or `pen`, and opens the menu through the menu's internal no-focus channel (SPB-22); Escape for a menu open from hover is a capturing keydown on the document. Each half draws its outline as an inside border and its elevation ring as an inset box-shadow layer, the blurred layers staying outside (SPB-26). The trailing half carries `aria-haspopup=\"menu\"`, `aria-expanded` and `aria-controls`, and is the menu's focus-return target. `busy` is a boolean attribute and `busy-label` a string one: while busy the leading half keeps the native button enabled, carries `aria-disabled=\"true\"` and `busyLabel` in `aria-description`, refuses its click in the capture phase on the host, and a `role=\"status\"` region in the shadow root, rendered only while busy, is given `busyLabel` a frame after it appears (SPB-40); `busyLabel` falls back to the product's words (`busyLabel`). `separation` (`auto`, `divider`, `gap`) and `trailing-width` (`default`, `narrow`) are attributes; auto reads the name in `--tanrei-comp-button-with-menu-container-separation`. Under divider the halves touch, the rule is drawn over the seam, and neither half draws a border or an inset ring on its inner edge. `destructive` is a boolean attribute; it draws both halves from the variant's destructive parts, exposes nothing more (SPB-35), and is not passed to the menu's items. `full-width` is a boolean attribute: the host fills its container's width, the leading half grows and the trailing half keeps its width (SPB-38); in a `tanrei-toolbar` it is ignored, as a Button's is."},"swiftui":{"status":"planned","name":"TanreiButtonWithMenu","props":{"variant":"variant","destructive":"role","size":"size","separation":"separation","trailingWidth":"trailingWidth","fullWidth":"fullWidth","label":"title","menuLabel":"menuLabel","open":"isMenuPresented","disabled":"disabled","busy":"busy","busyLabel":"busyLabel","hoverOpen":"opensOnHover","hoverDelay":"hoverDelay"},"events":{"click":"action","toggle":"isMenuPresented","close":"isMenuPresented"},"notes":"`TanreiButtonWithMenu(_ title:, icon:, menuLabel:, isMenuPresented: Binding<Bool>, opensOnHover: Bool = false, hoverDelay: Duration? = nil, action:, chevron:, openChevron:) { TanreiMenuItem … }`: the title first, as `Button(_:action:)`; `chevron` and `openChevron` are optional glyph builders (the chevron and chevron-open slots); the trailing view builder is the menu's content, presented as `TanreiMenu` is. The trailing half writes the binding (toggle), and so does the menu when it closes (close); a product that needs the close reason reads the menu's. `disabled` follows `.disabled(_:)`. Hover uses `.onContinuousHover` (macOS, and iPadOS with a pointer); a nil `hoverDelay` takes the token. SwiftUI's `Menu(primaryAction:)` is not used: neither half can be tokenised. Ships the previous revision today (6 px corners, a fixed turning chevron, no hover opening); the rest is owed, including a check of SPB-26 on this platform. Also owed: the component's current name, `separation` and `trailingWidth`, the divider (SPB-31), the outer padding (SPB-32), a trailing half that keeps its shape while open (SPB-13), the tighter padding beside the icon, and the new fixtures; reading comp.button-with-menu.container.separation as a typed choice needs the native token emitters to write a component's choice of kind as a typed enumeration, which they do not yet. Not built on this platform yet: `role: ButtonRole? = nil`, as SwiftUI's own `Button(role:)` takes it: `.destructive` is destructive (SPB-34), and the role is given to the leading half alone (SPB-35). Not built on this platform yet either: `fullWidth: Bool = false` (SPB-38), as `TanreiButton`'s, the leading half taking the extra width; and `busy: Bool = false` and `busyLabel: String = \"\"` (SPB-39, SPB-40), as `TanreiButton`'s, applied to the leading half alone."},"compose":{"status":"planned","name":"TanreiButtonWithMenu","props":{"variant":"variant","destructive":"destructive","size":"size","separation":"separation","trailingWidth":"trailingWidth","fullWidth":"fullWidth","label":"text","menuLabel":"menuContentDescription","open":"menuExpanded","disabled":"enabled","busy":"busy","busyLabel":"busyLabel","hoverOpen":"openOnHover","hoverDelay":"hoverDelayMillis"},"events":{"click":"onClick","toggle":"onMenuExpandedChange","close":"onMenuDismissRequest"},"notes":"`TanreiButtonWithMenu(text, onClick, menuContentDescription, menuExpanded, onMenuExpandedChange, onMenuDismissRequest, variant, size, enabled, icon, chevron, openChevron, openOnHover = false, hoverDelayMillis: Long? = null) { TanreiMenuItem(…) }`: `chevron` and `openChevron` are optional glyph lambdas (the chevron and chevron-open slots); the content lambda is the menu's, shown in the `TanreiMenu` popup. State hoisting: the caller keeps `menuExpanded`, sets it from `onMenuExpandedChange` (a press, a key or a hover) and to false from `onMenuDismissRequest`, which carries the reason. Hover reads `PointerEventType.Enter` / `Exit` for `PointerType.Mouse` and `Stylus` only; a null delay takes the token. The trailing half is `Role.Button` with a content description, and its expanded state as `expand` / `collapse` semantics actions. `enabled` is the inverse flag. Ships the previous revision today (6 px corners, a fixed turning chevron, no hover opening); the rest is owed, including a check of SPB-26 on this platform. Also owed: the component's current name, `separation` and `trailingWidth`, the divider (SPB-31), the outer padding (SPB-32), a trailing half that keeps its shape while open (SPB-13), the tighter padding beside the icon, and the new fixtures; reading comp.button-with-menu.container.separation as a typed choice needs the native token emitters to write a component's choice of kind as a typed enumeration, which they do not yet. Not built on this platform yet: `destructive: Boolean = false` (SPB-34); Compose has no destructive role, so it draws and adds no semantics (SPB-35). Not built on this platform yet either: `fullWidth: Boolean = false` (SPB-38), as `TanreiButton`'s, the leading half taking the extra width; and `busy: Boolean = false` and `busyLabel: String = \"\"` (SPB-39, SPB-40), as `TanreiButton`'s, applied to the leading half alone."},"flutter":{"status":"planned","name":"TanreiButtonWithMenu","props":{"variant":"variant","destructive":"isDestructiveAction","size":"size","separation":"separation","trailingWidth":"trailingWidth","fullWidth":"fullWidth","label":"label","menuLabel":"menuSemanticLabel","open":"menuController","disabled":"onPressed","busy":"busy","busyLabel":"busySemanticLabel","hoverOpen":"openOnHover","hoverDelay":"hoverDelay"},"events":{"click":"onPressed","toggle":"onMenuToggle","close":"onMenuClose"},"notes":"`TanreiButtonWithMenu(label:, icon:, chevron:, openChevron:, menuSemanticLabel:, onPressed:, menuController:, menuChildren: [TanreiMenuItem(…)], onMenuToggle:, onMenuClose:, openOnHover: false, hoverDelay: null, variant:, size:)`, built with the widgets library: `chevron` and `openChevron` are optional glyph widgets (the chevron and chevron-open slots); `menuChildren` are the menu's items, shown through `TanreiMenuAnchor`. The controller is a `TanreiMenuController` (the Tanrei menu's own), passed or created internally; it is open, so the button with menu opens and closes the menu itself; `onMenuToggle` and `onMenuClose` report it. Hover uses a `MouseRegion` and ignores `PointerDeviceKind.touch`; `hoverDelay` is a `Duration?`, null taking the token. A null `onPressed` disables it. Ships the previous revision today (6 px corners, a fixed turning chevron, no hover opening); the rest is owed, including a check of SPB-26 on this platform. Also owed: the component's current name, `separation` and `trailingWidth`, the divider (SPB-31), the outer padding (SPB-32), a trailing half that keeps its shape while open (SPB-13), the tighter padding beside the icon, and the new fixtures; reading comp.button-with-menu.container.separation as a typed choice needs the native token emitters to write a component's choice of kind as a typed enumeration, which they do not yet. Not built on this platform yet: `isDestructiveAction: false`, the widgets library's name for it (SPB-34); it draws and adds no semantics (SPB-35). Not built on this platform yet either: `fullWidth: false` (SPB-38), as `TanreiButton`'s, the leading half taking the extra width; and `busy: false` and `busySemanticLabel:` (SPB-39, SPB-40), as `TanreiButton`'s, applied to the leading half alone."},"react-native":{"status":"planned","name":"ButtonWithMenu","props":{"variant":"variant","destructive":"destructive","size":"size","separation":"separation","trailingWidth":"trailingWidth","fullWidth":"fullWidth","label":"label","menuLabel":"menuAccessibilityLabel","open":"menuVisible","disabled":"disabled","busy":"busy","busyLabel":"busyLabel","hoverOpen":"hoverOpen","hoverDelay":"hoverDelay"},"events":{"click":"onPress","toggle":"onMenuToggle","close":"onMenuDismiss"},"notes":"`<ButtonWithMenu label icon chevron openChevron menuAccessibilityLabel menuVisible hoverOpen hoverDelay onPress onMenuToggle onMenuDismiss menuItems={[…]} variant size>`: `chevron` and `openChevron` are optional glyph names (the chevron and chevron-open slots); `menuItems` is the `Menu`'s `items` array (the union of its four kinds), shown by a `Menu` on the overlay layer that `TanreiProvider` renders. Controlled: the caller sets `menuVisible` from `onMenuToggle` and to false from `onMenuDismiss`, which carries the reason. Hover uses `Pressable`'s `onHoverIn` / `onHoverOut`, which fire only for a pointer (iPadOS, Android with a mouse, web); `hoverDelay` is in milliseconds, undefined taking the token. The trailing half has the `button` role with `accessibilityState.expanded`. Ships the previous revision today (6 px corners, a fixed turning chevron, no hover opening); the rest is owed, including a check of SPB-26 on this platform. Also owed: the component's current name, `separation` and `trailingWidth`, the divider (SPB-31), the outer padding (SPB-32), a trailing half that keeps its shape while open (SPB-13), the tighter padding beside the icon, and the new fixtures; reading comp.button-with-menu.container.separation as a typed choice needs the native token emitters to write a component's choice of kind as a typed enumeration, which they do not yet. Not built on this platform yet: `destructive` (SPB-34); it draws and adds no accessibility props (SPB-35). Not built on this platform yet either: `fullWidth` (SPB-38), as `Button`'s, the leading half taking the extra width; and `busy` and `busyLabel` (SPB-39, SPB-40), as `Button`'s, applied to the leading half alone."}}}
@@ -0,0 +1 @@
1
+ {"name":"button","title":"Button","summary":"Lets people take an action, switch something on and off, go to a destination, or send or clear the form it stands in, with one tap or click — named by a label, an icon, or both.","level":"base","listing":"default","anatomy":[{"id":"container","description":"The shape that holds the content, defines the visual bounds and carries hover, focus and press. A pill with a label; with an icon alone, as wide as it is high (a circle in the default system's corner) or at the narrow or the wide width of its size."},{"id":"label","description":"Text that names the action.","optional":true},{"id":"icon","description":"A glyph of the system's icon set, at the leading or the trailing side of the label, or alone. Outlined when unselected, filled when selected.","optional":true},{"id":"outline","description":"The border of the outlined variant.","optional":true},{"id":"focus-ring","description":"Gap-then-ring indicator shown for keyboard focus."}],"props":[{"name":"variant","type":"enum","values":["filled","tonal","elevated","outlined","text"],"default":"filled","description":"Emphasis level; whether the action deletes or discards something is destructive, which every variant takes. Use one filled button per view for the main action; an icon-only text button is the quiet icon action of a toolbar or a row. A design system may add values. Default filled; a Button placed as a dialog's or a side sheet's action without a variant takes that host's (DLG-20, SSH-17), and a side sheet's close button takes comp.side-sheet.close-button.variant (SSH-5).","axis":"tanrei.comp.button.variant"},{"name":"destructive","type":"boolean","default":false,"description":"Marks an action that deletes or discards something a person may not get back (Delete, Discard, Remove member): the button keeps its variant's emphasis and takes the error role's color in it — filled in the error color, tonal in its tonal container, and the error color for the label of an elevated, outlined or text button and the edge of an outlined one (BTN-40). Use it for that kind of action alone, never for emphasis. It adds a color, not a meaning: the label still says what the button does (BTN-42). A toggle has no destructive look: ignored while toggle is true (BTN-41). A link deletes nothing: ignored while href is not empty (BTN-43)."},{"name":"size","type":"enum","values":["small","medium","large"],"default":"medium","description":"Visual height: comp.button.container.height.<size>, its hit area never below sys.target.minimum (28 / 36 / 52 under the default system, the small one drawn at its step), which is also an icon-only button's width at its default width. The hit area always meets the minimum target. While it is not set the button is drawn at the size its nearest container sets — a button group's or a toolbar's size (BTN-48) — and at medium where none does. A design system may add values.","axis":"tanrei.comp.button.size"},{"name":"width","type":"enum","values":["default","narrow","wide"],"default":"default","description":"How wide an icon-only button is. default: as wide as it is high (28 / 36 / 52 under the default system). narrow: its glyph with a small inset on each side (28 / 32 / 32), for a tight row of icon actions. wide: 40 / 52 / 72, for the one action of a row that should weigh more. Ignored when the button has a label, and while fullWidth is true. The hit area meets the minimum target at every width."},{"name":"fullWidth","type":"boolean","default":false,"description":"Makes the button take the whole width its container gives it, its content centred, at the height of its size (BTN-39): a form's only action on a narrow screen, the action at the foot of a card or a sheet. Ignored while a host lays the button out (a button group, a toolbar, or the actions of a dialog, a side sheet, a popover, a callout or an empty state), which gives it a width of its own (a button group's fullWidth for a row of them)."},{"name":"iconPosition","type":"enum","values":["leading","trailing"],"default":"leading","description":"Which side of the label the icon sits on, in the reading direction. Ignored when the button has no label or no icon."},{"name":"toggle","type":"boolean","default":false,"description":"Makes the button a two-state control: activation switches selected, and assistive technology announces it as pressed or not pressed. A toggle takes no destination: href is ignored while toggle is true."},{"name":"selected","type":"boolean","default":false,"description":"Whether a toggle is on. Ignored unless toggle is true."},{"name":"disabled","type":"boolean","default":false,"description":"Prevents interaction and removes the button from the focus order — unless focusableWhenDisabled keeps it there (BTN-38). A disabled button with a destination is not a link that can be followed (BTN-25); on the web a disabled submit button sends nothing, and still stops Enter from sending its form where it is the form's default button (BTN-32)."},{"name":"focusableWhenDisabled","type":"boolean","default":false,"description":"Keeps a disabled button in the focus order: it is drawn and exposed as disabled and refuses every activation, but a keyboard and a screen reader can still reach it, so that a person can learn why it does nothing (a tooltip, a description). For an action a person can make available — a send button while the message is empty. Ignored unless disabled is true (BTN-38)."},{"name":"busy","type":"boolean","default":false,"description":"The action it started is under way: the button keeps its focus, its place in the focus order and its size, draws the loading indicator's arc in place of its label and icon, refuses every activation, and tells assistive technology through busyLabel (BTN-36, BTN-37). For a save or a send that takes a moment; it is not disabled, so focus stays where the person left it."},{"name":"busyLabel","type":"string","default":"","description":"What assistive technology is told while the button is busy (\"Saving\"): announced once when it becomes busy and read after its name while it is. Tanrei ships no words of its own. Required while busy is true; ignored otherwise.","words":"busyLabel"},{"name":"href","type":"string","default":"","description":"The destination: an address as the platform's links take one (a URL; on the web a path or a fragment as well). Not empty, it makes the button a link and not a button: the link role, activated by pointer, touch or Enter and not by Space, opened by the platform as its own links are, and drawn exactly as the button it would otherwise be (BTN-22, BTN-23). Ignored while toggle is true: a control that holds a state is not a destination (BTN-26)."},{"name":"target","type":"enum","values":["same","new"],"default":"same","description":"Where the destination opens. same: where the person is — the same tab on the web, the app's own handling of the address elsewhere. new: a new context — a new tab or window on the web, outside the current screen elsewhere — which a labelled button marks with the glyph open_in_new after its label and says through targetLabel (BTN-24). Ignored without href."},{"name":"targetLabel","type":"string","default":"","description":"What assistive technology reads after the link's name while target is new (\"opens in a new tab\"). Tanrei ships no words of its own, so the product gives them in its own language, as it gives a chip its removeLabel. Required while target is new; ignored otherwise.","words":"targetLabel"},{"name":"label","type":"string","default":"","description":"The accessible name, where it is more than what the button draws. Required for an icon-only button: an icon alone is not a name. Optional for a button that draws a label: left empty, the drawn text is the name; given, it is the whole name in place of the drawn text, which stays drawn — for an action repeated in every row (drawn \"Reset\", named \"Reset: Spacing\") — and it must contain the drawn text, so that a person who says what they see is heard (BTN-16). It is about this one button, so it is the instance's alone and reads no word of the product's."},{"name":"value","type":"string","default":"","description":"What the button stands for, as data: never drawn and never announced. A component that holds a selection of Buttons reads it to tell which of them are selected — a toolbar group whose selection is single or multiple holds its selected members' values (TBR-28) — and on the web, with name, it is what a form is sent when this button submits it (BTN-31). Unique among the members of one selection."}],"slots":[{"name":"default","description":"Label content: the text that names the action. Leave it empty for an icon-only button."},{"name":"icon","description":"The icon: a glyph of the system's icon set, drawn through the platform's icon helper. With a label it sits at the side iconPosition names; without one it is the button's only content.","fixture":"glyph"}],"events":[{"name":"click","description":"The button was activated by pointer, touch, keyboard or assistive technology. A link button emits it before its destination opens; a product that takes the navigation itself (a client-side router) cancels it (BTN-23)."},{"name":"change","description":"A toggle was activated; carries the new value of selected."}],"states":["enabled","disabled","hovered","focused","pressed","selected","loading"],"behavior":[{"id":"BTN-1","text":"WHEN the user activates the button by pointer, touch, Enter or Space — a link button (BTN-22) by pointer, touch or Enter — THE button SHALL emit click exactly once."},{"id":"BTN-2","text":"WHILE disabled is true THE button SHALL NOT emit click or change, SHALL NOT be focusable and SHALL expose the disabled state to assistive technology."},{"id":"BTN-3","text":"WHILE hovered, keyboard-focused or pressed THE button SHALL render its container, label, icon, outline, elevation and opacity from the component tokens of the highest-precedence active state, with precedence pressed over focused over hovered; focus gained by pointer or touch SHALL NOT select the focused state."},{"id":"BTN-4","text":"WHEN the button receives keyboard focus THE button SHALL show the focus ring without animation; focus gained by pointer or touch SHALL NOT show it."},{"id":"BTN-5","text":"WHERE the visual size is below the minimum target THE button SHALL extend its hit area on both axes to sys.target.touch for touch input and sys.target.pointer for fine pointers, without changing its visual size; a platform that cannot tell the input type SHALL use sys.target.touch. WHERE a component lays the button out beside another control — in a row or a column of its own, as a button group, a toolbar, the actions of a dialog, the controls of a snackbar or a field's own buttons do — THE button SHALL extend its hit area toward that neighbour no further than the middle of the gap between their visible bounds, and toward a side where nothing of the row stands as far as the row's own place allows, so that a press on a neighbour's visible bounds is never the button's and a press in the gap goes to the nearer of the two. WHERE the product lays buttons out beside each other itself, outside any such component, THE button SHALL take from the product how far its hit area may reach past its visible bounds toward each side — the start and the end of the row, the top and the bottom of a column — and reach no further, never less than its visible bounds; a component that lays the button out in a row of its own decides the reach toward the others in that row, over what the product gave around it, and the product's reaches the sides that component leaves open (the outer ends of a button group)."},{"id":"BTN-6","text":"WHILE disabled is true THE button SHALL render its container, label, icon, outline, elevation and opacity from the disabled component tokens of its variant and, for a toggle, of its selection, and, while destructive is true, of its destructive parts (BTN-40)."},{"id":"BTN-7","text":"WHEN variant or size names a value that the active design system does not have THE button SHALL render with the default value's tokens, and in debug builds report the unknown value."},{"id":"BTN-8","text":"WHEN the button is pressed by pointer, touch, Enter or Space THE button SHALL show the pressed state without delay and SHALL keep it visible for at least sys.motion.duration.press-hold, even when the press ends sooner."},{"id":"BTN-9","text":"WHILE pressed THE button SHALL answer as sys.behavior.pressed-feedback names: overlay applies the pressed tokens to the whole container at once; ripple grows the pressed state layer from the point of contact (from the center for keyboard activation); dim applies the pressed opacity to the whole control and draws no state layer; none draws no answer to the press. Under ripple and dim only the container color stays with the state under the press; label, icon, outline, elevation, opacity and shape still come from the pressed tokens. Under none every part stays with the state under the press. The ripple grows over comp.button.motion.feedback-duration with motion.state-easing, fades over the motion.state-duration of its size with motion.state-easing once the press has ended and press-hold has passed, and appears whole where motion is reduced."},{"id":"BTN-10","text":"THE button SHALL ease its container corners by sys.shape.corner-smoothing (0 is a quarter circle, 0.6 the iOS continuous corner; a platform with only the OS curve draws it for any amount above 0) and show its keyboard focus as sys.behavior.focus-style names (ring or glow); a platform that cannot draw a choice SHALL fall back to the first value and state that in its README. WHILE the button is an item of a connected button group THE button SHALL draw its corners and minimum width and height as the group sets them, the padding the group adds at a rounded outer end, and neither outline nor elevation ring along an edge the group joins to a neighbour under a divider, and, from a dialog, a side sheet or an image preview, its variant while none is set (DLG-20, SSH-17, IMP-8) and a host's close-button variant — the popover's, the side sheet's, the bottom sheet's, the callout's and the snackbar's close button, each an icon-only Button of the small size (POP-13, SSH-5, BSH-29, CLO-10, SNK-34; the image preview's bar names one variant for its close and zoom controls, IMP-8), from any component that draws it on a colored surface of its own, a tone (BTN-45), and, from a toolbar group whose selection is single, that it is one choice of that group (BTN-47), through an internal channel that is not part of its public surface (BGR-2, BGR-3, BGR-16, BGR-22, BGR-23)."},{"id":"BTN-11","text":"WHILE the button has both a label and an icon THE button SHALL draw the icon at the side iconPosition names in the reading direction (leading at the start, trailing at the end, both mirrored in right-to-left layouts) and the label comp.button.container.gap.medium from it at the medium size (and the gap of its own size otherwise), with comp.button.container.padding-inline-start-with-icon.medium on the icon's side for a leading icon and comp.button.container.padding-inline-end-with-icon.medium for a trailing one, and the plain padding (comp.button.container.padding-inline-start.medium, comp.button.container.padding-inline-end.medium) on the other side, each of its own size; WHILE it has a label and no icon it SHALL use the plain padding on both sides and ignore iconPosition."},{"id":"BTN-12","text":"WHILE the button has an icon and no label THE button SHALL draw its container at the height of its size — comp.button.container.height.medium at the medium size, and the height of its own size otherwise — and at the width its width names: as wide as it is high WHILE width is default, as wide as its glyph's box (comp.button.icon.size-without-label.medium) with comp.button.container.padding-inline-narrow.medium on each side of it WHILE width is narrow, and comp.button.container.width-wide.medium wide WHILE width is wide (each of its own size), with the glyph centred, and SHALL round it by comp.button.container.shape, capped at half its shorter side, so that the default system's sys.shape.corner.full draws a circle at the default width and a capsule at the other two, and a smaller corner a rounded square or rectangle. The narrow width SHALL be the glyph and that inset twice, and nothing more: the button has no narrow width of its own to disagree with them, so a narrow button follows its glyph wherever a design system re-sizes it, and its container, state layer, ripple and outline are a capsule of that width. In the default system the inset is sys.space.space50 at every size, the least room that keeps the glyph clear of the capsule's edge; a design system that wants its narrow buttons to differ more by size gives a size a larger inset. It SHALL NOT draw an icon-only button at any other width, except to the minimum width a connected button group sets and the padding that group adds at an outer end (BTN-10). WHERE text size scales the glyph (every size follows the root font size on the web) the container SHALL grow with it and keep the proportion of its width to its height."},{"id":"BTN-13","text":"THE button SHALL draw its icon at the icon box of its size — comp.button.icon.size.medium beside a label and comp.button.icon.size-without-label.medium alone at the medium size, and so on — with the family and fill of its selection (sys.icon.family.selected and sys.icon.fill.selected only when toggle and selected are both true; otherwise sys.icon.family.unselected and sys.icon.fill.unselected), sys.icon.weight, and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max; beside a label the icon SHALL take the label color of the button's look, and alone the icon color of its look (comp.button.text.icon.color for a plain text button, comp.button.text.selected.icon.color for a text toggle that is on, and so on)."},{"id":"BTN-14","text":"WHEN toggle is true and the user activates the button THE button SHALL emit click and then change with the opposite of selected, in that order (as a native checkbox does, and as CHP-11 says for a filter chip), and SHALL expose selected to assistive technology as pressed or not pressed; WHILE toggle is false THE button SHALL NOT expose a pressed state."},{"id":"BTN-15","text":"WHILE toggle is true THE button SHALL render its container, label, icon and outline from the selected parts of its variant when selected is true (comp.button.filled.selected.container.color, and so on) and from the unselected parts when it is false (comp.button.filled.unselected.container.color, and so on), and its elevation from its variant's own comp.button.filled.container.elevation (and so on); WHILE toggle is false it SHALL render from the variant's own parts."},{"id":"BTN-16","text":"WHILE the label prop is not empty THE button SHALL expose it as its accessible name, whole and alone, whether or not it draws a label; WHILE the label prop is empty and the button draws a label THE button SHALL expose the drawn label's text as its accessible name; WHILE the label prop is empty and the product gives the button a name of its own on the element — aria-label, or aria-labelledby naming an element — THE button SHALL expose that name as its accessible name, over the drawn label's text where it draws one, because the platform's text alternative computation puts an author's name over the element's content; WHILE the label prop is not empty THE label prop SHALL be the name, over the product's. WHILE it has an icon and no drawn label THE button SHALL keep the glyph from assistive technology, and WHILE the label prop is empty as well and the product gives it no name of its own SHALL still render, and in debug builds report that it has no accessible name. WHILE the button draws a label and the label prop is not empty THE button SHALL draw the label exactly as it would without the prop, SHALL NOT expose the drawn text a second time beside the name, and in debug builds SHALL report a label prop that does not contain the drawn text — the two compared with white space at their ends dropped, runs of white space read as one space and letters compared without case — because a person who speaks the words they see must be heard by the control that shows them. That report SHALL be all the button does about it: it SHALL still expose the label prop, whole and alone, as the name, SHALL NOT fall back to the drawn text and SHALL NOT add the drawn text to the name, in a debug build as in any other. THE button SHALL NOT make a name of the two itself, by joining them or in any other way: the order of a phrase is the language's, and the whole name is the product's to give. A description — the platform's own, or targetLabel (BTN-24) — SHALL be read after the name and the role and SHALL NOT be exposed as a name or as part of one."},{"id":"BTN-17","text":"IF the button has neither a label nor an icon THE button SHALL still render its container at the height of its size and as wide as it is high, and in debug builds report that it has no content."},{"id":"BTN-18","text":"THE button SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the button is shown THE button SHALL draw itself for the new direction at once, without a motion of its own, keeping its selection and its focus."},{"id":"BTN-19","text":"WHERE the layout direction is right-to-left THE button SHALL draw the glyph of its icon slot mirrored left to right exactly when the system's icon set marks that glyph's name as mirrored or the product forces mirroring for that use, and unmirrored when the product forbids it: the icon helper mirrors the glyph inside its own box, about the box's vertical centre line, changing neither its place, size, color and fill nor the order BTN-11 gives. THE button SHALL NOT mirror a glyph itself, and SHALL NOT mirror content the product gives as an image or a view of its own rather than by a glyph's name."},{"id":"BTN-20","text":"THE button SHALL lay out its label as text of its own direction, isolated from the text around it: each takes the base direction of its first strong character, or the layout direction where it has none, so that a left-to-right word, a number with its sign or unit, a telephone number and an address keep their own order in a right-to-left layout and reorder nothing beside them; THE button SHALL still place the label and align its lines by the layout direction, not by the text's own."},{"id":"BTN-21","text":"WHILE the button has a label THE button SHALL ignore width: a labelled button is as wide as its content and its paddings (BTN-11). WHEN width names a value the button does not define THE button SHALL render at the default width, and in debug builds report the unknown value. THE button SHALL meet the minimum target of BTN-5 at every width by extending its hit area: a narrow button SHALL NOT be drawn wider to reach it."},{"id":"BTN-22","text":"WHILE href is not empty and toggle is false THE button SHALL be a link and not a button: it SHALL expose the link role, named as BTN-16 names a button, with no pressed state; SHALL be the platform's own link to href (the web's anchor element; SwiftUI's Link; on Compose, Flutter and React Native an element with the platform's link semantics whose address is opened by the platform's opener), so that whatever the platform gives a link — on the web its context menu, opening in a new tab or window, copying and dragging its address, and the address shown before it is followed — is the platform's, and not the button's to draw or to take over; and SHALL draw its container, label, icon, outline, elevation and opacity in every state from the same tokens as a button of its variant, size and width that has no destination, with no look of its own for a link and none for a destination already visited."},{"id":"BTN-23","text":"WHEN the user activates a link button by pointer, touch or Enter THE button SHALL emit click exactly once and then open href where target names, unless the product cancelled that click, in which case it SHALL open nothing: the product's own router has taken the navigation. It SHALL show the pressed state as BTN-8 and BTN-9 say and SHALL NOT hold the navigation back for sys.motion.duration.press-hold. THE button SHALL NOT activate a link button on Space, which on the web scrolls the page as it does on any link, and SHALL NOT show the pressed state for it; WHERE the platform gives its links other keys or gestures (on the web a modified or a middle click that opens a new tab, on Apple platforms a long press that previews) THE button SHALL leave them to the platform."},{"id":"BTN-24","text":"WHILE the button is a link and target is new THE button SHALL open href in a new context — on the web a new tab or window that is given no handle to the page that opened it; on the other platforms outside the screen the person is on, as the platform's opener decides — and, WHILE it has a label and no icon at its trailing side, SHALL draw the glyph open_in_new of the system's icon set after the label as BTN-11 draws a trailing icon: comp.button.container.gap.medium from the label, at comp.button.icon.size.medium, with comp.button.container.padding-inline-end-with-icon.medium between it and the end edge at the medium size (and each of its own size otherwise), a leading icon keeping its own side as BTN-11 says; in the label color of its look and state; through the icon helper, which mirrors it in a right-to-left layout because the icon set marks its name; and hidden from assistive technology. WHILE the button holds the product's own icon at its trailing side, or has no label, THE button SHALL draw no mark of its own: the product has chosen what that place shows. Whether a mark is drawn or not THE button SHALL expose targetLabel as its description, read after its name and role, and WHILE targetLabel is empty SHALL still render and in debug builds report that a link that opens a new context does not say so. WHILE target is same THE button SHALL draw no mark and SHALL ignore targetLabel."},{"id":"BTN-25","text":"WHILE href is not empty and disabled is true THE button SHALL NOT be a link that can be followed: it SHALL render as BTN-6 says, the mark of BTN-24 in the disabled label color, SHALL expose the link role with the disabled state and no destination, SHALL NOT be focusable, SHALL NOT emit click, and SHALL open nothing by any means the platform gives a link (on the web the anchor carries no href, so there is no context menu entry, no drag and no new tab for it)."},{"id":"BTN-26","text":"WHILE toggle is true THE button SHALL ignore href, target and targetLabel and stay the toggle BTN-14 describes, and in debug builds SHALL report that a toggle cannot be a link: a control that holds a state is not a destination. WHEN target names a value the button does not define THE button SHALL behave as same, and in debug builds report the unknown value. IF href is only white space, or names a script to run rather than a place to go (the web's javascript: scheme), or cannot be read as an address by the platform, THE button SHALL be a button without a destination, and in the last two cases report it in debug builds."},{"id":"BTN-27","text":"WHERE the platform has a form element (the web) and WHILE type is submit, WHEN the user activates the button by any means of BTN-1 and the product has not cancelled its click THE button SHALL ask its form (BTN-29) to submit as the platform's own submit button does: after click has been emitted, exactly once for one activation, with the form's own validation run first and its failure shown by the platform and by the fields as they show it, then the form's submit event, which the product may cancel, and with the pressed button named in what is sent (BTN-31). It SHALL show the pressed state as BTN-8 and BTN-9 say and SHALL NOT hold the submission back for sys.motion.duration.press-hold. WHILE type is button, which is the default, THE button SHALL do nothing to any form, whatever it stands in."},{"id":"BTN-28","text":"WHERE the platform has a form element (the web) and WHILE type is reset, WHEN the user activates the button and the product has not cancelled its click THE button SHALL ask its form (BTN-29) to reset as the platform's own reset button does: after click has been emitted, the form's reset event, which the product may cancel, and then every control of the form back at its initial value; it SHALL validate nothing, submit nothing and add nothing to any later submission."},{"id":"BTN-29","text":"THE button's form SHALL be the one the platform gives a control at its place: the nearest form among its ancestors, or, WHILE the web's form attribute is not empty, the form of that id in the same document, and then not an ancestor; it SHALL be read when the button is activated, so that a button moved into a form, or a form attribute written later, is followed. WHERE the platform lists a form's controls (the web's form.elements) THE button SHALL be listed among them at its place in document order, whatever its type and also WHILE type is button — a link button too, since the element is one kind of control — and being listed SHALL send nothing: a Button adds to a submission only what BTN-31 says. IF type is submit or reset and the button has no form WHEN it is activated THE button SHALL emit click and do nothing more, and in debug builds report that a submit or a reset button has no form."},{"id":"BTN-30","text":"WHERE the platform has a form element (the web) THE default button of a form SHALL be the first submit button among the form's controls in document order, a Button whose type is submit counted exactly as the platform's own submit button is. WHEN the person presses Enter in a field of the form that submits it implicitly — the platform's own single-line inputs; Tanrei's text field (TXI-3), number field (NMI-20), color field (CLI-19), combobox (CMB-28), one-time-code input (OTC-13) and search (SRC-13), once their own event for that key has not been cancelled; and Tanrei's checkbox, radio button and switch, which emit nothing for the key (CHK-1, RAD-1, SWT-1) — and the default button is a Button, THE button SHALL act as if it had been activated: click emitted exactly once, and then, unless the product cancelled it, the submission of BTN-27 with that button named in it (BTN-31); it SHALL NOT show the pressed state for a key pressed elsewhere and SHALL NOT take focus. WHILE the default button is disabled — a Button or the platform's own — THE form SHALL NOT be submitted by Enter in any of those controls, as the platform's own disabled default button prevents it from the platform's own inputs. WHILE the default button is the platform's own, Enter in a Tanrei control SHALL press it as Enter in the platform's own input does: its click, then the submission with its name and value. WHILE the form has no submit button of either kind THE button has no part in it: the field and the platform do as they do without one. THE button SHALL draw a form's default button no differently from any other: its emphasis is its variant's."},{"id":"BTN-31","text":"WHEN a Button submits its form (BTN-27, BTN-30) THE submission SHALL carry the pair of that button's name and value — once, at most, and only WHILE its name is not empty; an empty value is sent as an empty value — and SHALL carry nothing of any other Button; WHEN the form is submitted by other means (another button, a script's own request) it SHALL carry nothing of this one. THE submit event SHALL name as its submitter a submit button of the platform's own that holds the same name and value and lasts no longer than the event's dispatch, because the platform lets only its own buttons be a submitter: a product reads which button was pressed from that name and value, or from click, and SHALL NOT expect the submitter to be the Tanrei element. THE button SHALL NOT override where or how its form is sent: the address, the method, the encoding, the target and whether the form is validated are the form's alone."},{"id":"BTN-32","text":"WHILE disabled is true THE button SHALL submit and reset nothing by any means — a press, a key, assistive technology or a script's click — SHALL add nothing to a submission, and SHALL still be counted as its form's default button where it is the first submit button (BTN-30), so that a form whose button is disabled is not sent by Enter behind it. WHERE the platform has a form element (the web), WHILE the button is not a link and stands in a group of controls the page has disabled as a whole (a disabled fieldset) THE button SHALL be disabled exactly as BTN-2 and BTN-6 say, whatever its type, and SHALL be enabled again at once when the group is; a link button SHALL NOT be disabled by it, as no link of the platform is."},{"id":"BTN-33","text":"WHILE toggle is true THE button SHALL ignore a type of submit or reset and stay the toggle BTN-14 describes, and in debug builds SHALL report that a toggle cannot submit or reset a form: a press that switches a state is not one that sends it. WHILE the button is a link (BTN-22) THE button SHALL ignore a type of submit or reset and stay the link, and in debug builds SHALL report that a link cannot submit or reset a form: it goes somewhere, and what a form sends on the way is the form's own action. WHEN type names a value the button does not define THE button SHALL behave as button and submit nothing — where the platform's own button would submit for an unknown type — and in debug builds report the unknown value. WHILE type is button THE button SHALL send nothing of its name or its value and ignore the web's form, without a report: they do no harm on a button that sends nothing, and its value stays what a component that places it reads (BTN-44)."},{"id":"BTN-34","text":"WHERE the platform has no form element (SwiftUI, Compose, Flutter, React Native) THE button SHALL have no type, no form and no name, and SHALL send its value nowhere — it stays what a component that places the button reads (BTN-44): there a product calls one function of its own from the button's click and from a field's action (TXI-3), and nothing of Tanrei's joins the two or decides which button a key in a field presses."},{"id":"BTN-36","text":"WHILE busy is true THE button SHALL draw its container, outline, elevation and opacity from its enabled tokens (of its variant and, for a toggle, of its selection, or of its destructive parts, BTN-40), SHALL keep its label and icon in place without drawing them so that its width and height do not change, and SHALL draw at the centre of the container the loading indicator's arc (LDG-1; under reduced motion LDG-4's whole circle, its opacity easing from 1 down to comp.button.motion.busy-pulse-floor-opacity and back once per cycle, never drawn below it) in a box of the button's icon size (icon.size-without-label where it is icon-only), comp.button.busy.indicator.thickness thick, in the label color of its variant (the icon color where it is icon-only), turning once per comp.button.motion.busy-cycle-duration. It SHALL show neither the hovered nor the pressed state, and SHALL show the focused one. WHEN busy becomes true THE button SHALL fade its label and icon out, and WHEN busy becomes false SHALL fade them back in, over comp.button.motion.busy-fade-duration on comp.button.motion.state-easing (sys.motion.role.state.compact and sys.motion.easing.state), a change of opacity alone in which nothing changes place or size, turned round from the opacity then drawn where busy changes again during it (MOT-2); the arc SHALL appear and go at once, and what it exposes to assistive technology (BTN-37) SHALL change at once, not at the end of the fade, its name staying as it was throughout. WHERE motion is reduced THE button SHALL draw its label and icon, or stop drawing them, at once."},{"id":"BTN-37","text":"WHILE busy is true THE button SHALL keep its focus and its place in the focus order, SHALL NOT emit click or change, and SHALL submit, reset and open nothing by any means (a press, a key, assistive technology or a script's click); where it is its form's default button it SHALL stop Enter in a field of the form from submitting it, as a disabled default button does (BTN-30, BTN-32), so that a form is not sent twice. It SHALL expose to assistive technology that it cannot be activated now (on the web aria-disabled) and busyLabel as its description, read after its name, and WHEN busy becomes true SHALL have busyLabel announced once, politely, without moving focus; nothing SHALL be announced when it ends, because what the action did is the product's to say. WHILE busy is true and busyLabel is empty THE button SHALL still render and in debug builds report that a busy button does not say so."},{"id":"BTN-38","text":"WHILE disabled is true and focusableWhenDisabled is true THE button SHALL be drawn as BTN-6 says and refuse every activation as BTN-2, BTN-25 and BTN-32 say, but SHALL stay in the focus order, take focus from the keyboard and from a pointer, keep focus when it becomes disabled, show its focus indicator, and expose the disabled state to assistive technology while staying focusable (on the web aria-disabled, not the platform's disabled state), so that a person can reach it and learn why it does nothing. It SHALL show neither the hovered nor the pressed state. A link button so disabled is the disabled link of BTN-25, reachable by Tab. WHERE the platform disables a group of controls as a whole (a disabled fieldset on the web) THE button SHALL leave the focus order with the group, whatever focusableWhenDisabled says, as the platform's own controls do. WHILE focusableWhenDisabled is false, disabled keeps its meaning (BTN-2)."},{"id":"BTN-39","text":"WHILE fullWidth is true and no host lays the button out THE button SHALL take the whole inline size its container gives it, and SHALL keep the height, the paddings, the corners, the outline and the minimum target of its size, variant and state, centring its content in that width — the label and the icon as one row, in the order and at the gap BTN-11 gives them, or an icon-only button's glyph, whatever width says. WHERE that width is narrower than the label THE button SHALL wrap the label, its lines centred, rather than truncate it or draw past its container. WHILE a host lays the button out (a button group, a toolbar, or the actions of a dialog, a side sheet, a popover, a callout or an empty state) THE button SHALL take the width that host gives it and ignore fullWidth: the host's own full width (BGR-17) is how a row of buttons shares one width."},{"id":"BTN-40","text":"WHILE destructive is true and toggle is false THE button SHALL render its container, label, icon and outline from the destructive parts of its variant (comp.button.filled.destructive.container.color, and so on for each variant), in each state from the destructive parts of that state, and its elevation, shape and opacity as it would without destructive; WHILE destructive is false it SHALL render from the variant's own parts. In every shipped system the destructive parts are the error color role at the variant's emphasis — filled: the error color with the on-error color on it; tonal: the error container with the on-error-container color on it; elevated, outlined and text: the variant's own container with the label and the icon in the error color, and an outlined button's edge in it too — and disabled they are those of the variant's plain disabled look, so that a disabled destructive button looks like any disabled button of its variant. An icon-only button takes destructive as a labelled button does; a link button ignores it (BTN-43)."},{"id":"BTN-41","text":"WHILE toggle is true THE button SHALL ignore destructive and render as BTN-15 says, and in debug builds SHALL report that a toggle has no destructive look: a control that switches a state on and off does not delete anything by being pressed."},{"id":"BTN-42","text":"THE button SHALL NOT make color the only sign that its action is destructive: WHILE destructive is true it SHALL keep its role, its accessible name, its states and its keyboard behaviour exactly as they are without it, and SHALL expose nothing more to assistive technology on the web, where no role or state says it; WHERE the platform has a destructive role of its own (SwiftUI's ButtonRole.destructive) THE button SHALL be given that role. Its label, or its label prop on an icon-only button, says what it destroys."},{"id":"BTN-43","text":"WHILE the button is a link (BTN-22) THE button SHALL ignore destructive and render as the link button of its variant without it, in each state and on a tone a host gives it (BTN-45), and in debug builds SHALL report that a link only leads somewhere and does not itself delete anything: the action that deletes is the one at its destination, and that action carries destructive."},{"id":"BTN-44","text":"THE button SHALL hold value as data alone: it SHALL draw nothing of it, expose nothing of it to assistive technology, and change neither its look nor its behaviour with it. The component that places the button reads it to tell which of its Buttons a selection holds (a toolbar group's value and values, TBR-28); WHERE the platform has a form element (the web), a submission the button makes carries it with name (BTN-31)."},{"id":"BTN-45","text":"WHERE the component that places the button gives it a tone through the internal channel (BTN-10) — the content color of the colored surface it draws the button on (a status callout's, an inverse or status snackbar's), and optionally the color a focus indicator's outer stroke takes on that surface — THE button SHALL draw its plain look in that tone instead of its variant's own colors, at rest and in each state: its label, its icon and its state layer in the tone's color; its container, where its variant draws one at rest (filled, tonal, elevated, and a variant a layer adds), in the tone's color at comp.button.tone.container.opacity, and where its variant draws none (outlined, text) as its variant's own, an outlined button's edge taking the tone's color at that opacity instead; hovered, focused and pressed, that resting container with the tone's color laid over it at the system's state-layer opacity of the state (sys.state.hover-state-layer-opacity, sys.state.focus-state-layer-opacity, sys.state.pressed-state-layer-opacity), as the core rules lay a state over a resting color; disabled, the container (where its variant draws one) in the tone's color at sys.state.disabled-container-opacity and the label and icon at sys.state.disabled-content-opacity; and the outer stroke of its focus indicator in the tone's focus color, or its color where none is given. Its size, shape, paddings, elevation, opacity and answer to a press SHALL be its own, and a toggle and a destructive button SHALL keep their own looks (BTN-15, BTN-40). WHILE no tone is given THE button SHALL be drawn as without this clause. A tone is not part of the button's public surface: no prop, attribute or styling property gives one."},{"id":"BTN-46","text":"WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE button SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the element that carries its role — an id reference by the elements it names in the host's tree or a tree around it, an error message as part of the description while the button is invalid — except those the button owns (aria-pressed, aria-disabled), which it SHALL move and not expose. WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE button SHALL take it off that element. WHEN the product sets an aria- attribute the button owns THE button SHALL report it in debug builds."},{"id":"BTN-47","text":"WHERE the component that places the button makes it one choice of a single selection through the internal channel (BTN-10) — a member of a toolbar group whose selection is single (TBR-28) — and WHILE toggle is true THE button SHALL expose itself to assistive technology as a radio button, checked while selected and not checked otherwise, with no pressed state, and SHALL keep its looks, its name and its keys as a toggle (BTN-15, BTN-16). WHEN the user activates it while it is not selected it SHALL become selected and emit click and then change, as BTN-14 says; WHEN the user activates it while it is selected it SHALL emit click alone and stay selected, because a choice of one is changed by choosing another. WHILE no component gives it that place THE button SHALL be the toggle BTN-14 describes."},{"id":"BTN-48","text":"WHILE size is not set and a container around the button sets a size for what it holds — a button group's size (BGR-26) or a toolbar's (TBR-31), the nearest such container where several do — THE button SHALL be drawn at that size, its height following the system's height ladder as at a size of its own, and at its nearest size where it has none of that name, in the order extra-small, small, medium, large, extra-large, the larger of two as near; a container whose size is not set SHALL pass none. WHILE size is set THE button SHALL be drawn at its own size, whatever a container sets. WHEN the size it takes changes — a container's size set, changed or removed, its own size set or removed, or the button moved into or out of such a container — THE button SHALL be drawn at the size it now takes at once."},{"id":"BTN-49","text":"IF the icon set cannot draw a glyph the button shows yet — the glyph of its icon slot, or the mark of a link that opens a new context (BTN-24); its font is still loading or failed to load — THE button SHALL draw nothing in that glyph's place, never the glyph's name as text, SHALL keep the glyph's box at its size so that nothing else moves, SHALL still draw its container and label and expose its name and state, and SHALL show the glyph once the icon set can draw it, without a motion."}],"accessibility":{"role":"button (link while href is set)","keyboard":[{"keys":"Tab","action":"Moves focus to the button — also to a busy one, and to a disabled one while focusableWhenDisabled is true."},{"keys":"Enter or Space","action":"Activates the button; a toggle switches selected. A link button is activated by Enter alone: Space does what it does on any link (on the web it scrolls the page)."},{"keys":"Enter in a field of the same form","action":"On the web, presses the form's default button — its first submit button — where that is a Button of type submit, and so submits the form; nothing while that button is disabled (BTN-30). Enter in a Tanrei field, checkbox, radio button or switch does the same where the default button is the platform's own."}],"labeling":"A button that draws a label is named by that text, unless label is given: then label is the whole name, in place of the drawn text, and it must contain the drawn text (BTN-16). An icon-only button is named by label, which is required; its glyph is decorative to assistive technology. A tooltip may show the same text to sighted pointer users, but it never replaces label. A link button is named in the same way; its name should say where it goes. While target is new, targetLabel is its description (\"opens in a new tab\"), and the mark is decorative. A description is read after the name and is never the name: what tells one button from its neighbours belongs in the name, and what happens next belongs in the description.","minimumTarget":true,"notes":["A toggle is a button with an on/off state (aria-pressed on the web, the selected trait on Apple platforms, a toggleable state on Android), not a checkbox or a switch; its name does not change with its state. In a toolbar group whose selection is single it is one choice of a radio group instead, checked or not checked (BTN-47).","Text must remain readable at 200% text size: the container grows, the label never truncates by default.","Container heights are minimums: at larger text sizes the container grows in both axes. An icon-only button's glyph is not text, at any of its three widths: where sizes are points or dp (SwiftUI, Compose, Flutter, React Native), text size leaves its circle and its glyph as they are; on the web every Tanrei size follows the root font size (rem), so at 200% text size the circle and its glyph grow together and stay round and whole (BTN-12). Either way its label is still announced.","The icon's side follows the reading direction: leading is the start (left in left-to-right, right in right-to-left). A glyph whose name the system's icon set marks as mirrored (arrow_forward, chevron_right, reply) is mirrored in a right-to-left layout by the icon helper, not by the button, and the product can force or forbid that for one use (BTN-19).","How a state looks is a value decision of the active design system (a state-layer mix in Tanrei, possibly explicit colors, a dim, or no hover at all elsewhere). Components read the state's tokens and never compute the effect themselves, with one exception: on a tone a host gives it (BTN-45), whose color is known only where the button is drawn, the button lays the tone over its container at the system's state-layer opacities, as a carousel lays its state layer over a product's image. A system that draws no state layer sets those opacities to 0.","A narrow icon-only button is drawn narrower than the minimum target; its hit area is not (BTN-21). Leave room for the target beside it, or put narrow buttons in a toolbar or a group that spaces them.","The outline of an outlined button is the hairline of the default system (the divider's color), which is far below 3:1 against the surface. That is within WCAG 1.4.11: the edge is not what identifies the control. Its label is text held to 4.5:1 and its icon to the same ratio, a toggle that is on is shown by its fill, and focus by the focus ring. A product whose outlined buttons must show a 3:1 edge sets comp.button.outlined.outline.color to sys.color.outline in a layer.","A button with a destination is a link: the link role, the platform's own link, Enter and not Space. It is not a button that navigates from a click handler: on the web such a button has no address to copy, cannot be opened in a new tab and is announced as something that acts on the page. The look does not say which of the two it is, and need not: sighted people tell a destination from an action by its label, as they do in a toolbar.","Tanrei draws no visited state for a link button: it is a control whose color says its emphasis and its state, and the web restricts what a visited link may change to colors a page cannot read back. Visited links are a matter for links in running text.","A link that opens a new context says so twice: the open_in_new mark for people who see it, and targetLabel for people who do not (WCAG 1.1.1: the mark carries information, so it needs a text alternative; technique G201 advises warning before a new window). The words are the product's.","An action repeated in every row of a list or a table is drawn with one word and named for its row: label is the whole name (\"Reset: Spacing\"), opening with the drawn word where the language allows. Six buttons that are all named \"Reset\" cannot be told apart in the list of controls a screen reader offers, and a description does not appear there. The name must contain the drawn text (WCAG 2.5.3, label in name): a person who uses speech input says the word on the button. A debug build reports a name that does not; it never repairs one, because joining two texts into a phrase is a decision about a language, and the words are the product's.","On the web a Button of type submit or reset is its form's button as the platform's own is: the form validates, fires its submit or reset event, and the pressed button's name and value are sent with it. Enter in a field presses the form's first submit button, and a disabled one stops it. The default type is button, not the platform's submit: a button put in a form for another purpose must never send it by accident (BTN-27, BTN-33).","A button can keep a form from being sent twice: while busy it is shown and focusable but refuses every press, emits no click and therefore submits nothing (BTN-27 follows click), and it stops Enter in a field as a disabled default button does (BTN-37, BTN-32). Prefer it to disabling the button while the first submission is on its way: a disabled button drops the person's focus, and says nothing of why.","Where script does not run, or before the element is defined, a web Button is its text and nothing else, and submits nothing; so is every Tanrei field, so a form made of them cannot be filled either. A form that must be sent without script is made of the platform's own controls, with the platform's own submit button.","The native platforms have no form element, and the Button has no type there (BTN-34): which button the Return key presses is the app's to say, in the platform's idiom.","A disabled button leaves the focus order, so a keyboard or screen-reader user may never learn it is there or why it does nothing. Where a person can make the action available (fill in the message, choose a file), keep it reachable with focusableWhenDisabled and say why in a tooltip or a description; where the action simply does not apply, leave it out of the focus order (BTN-38).","destructive adds a color, never a meaning (WCAG 1.4.1, use of color): the error color tells people who see it that the action deletes or discards something, and nothing tells a screen reader user so but the label. So the label names the action and what it acts on (\"Delete project\", not \"OK\"), and a dialog that confirms it says what will be lost in its headline and supporting text. The web has no role or state for a destructive action, so none is invented; SwiftUI's destructive role is given where it exists, and the platform decides what it does with it.","Disabled, a destructive button looks like any disabled button of its variant: the error color is a warning about what a press would do, and a button that cannot be pressed does nothing.","A tone keeps a button readable on a colored surface its host draws (a status callout, an inverse snackbar): the button's content takes the surface's own content color, which the host holds to the contrast its own text needs, and its container is a translucent layer of that color rather than a color chosen against the page. The layer lowers the contrast between the content and what is under it a little (at 16 % in the default system, about a sixth of the way from the surface toward the content color): a host's content color must still hold 3:1 against that blend for an icon-only button (WCAG 1.4.11) and 4.5:1 for a labelled one (WCAG 1.4.3)."]},"tokens":"comp.button","fixtures":[{"id":"filled-medium","props":{"variant":"filled"},"content":"Deploy"},{"id":"tonal-medium","props":{"variant":"tonal"},"content":"Deploy"},{"id":"elevated-medium","props":{"variant":"elevated"},"content":"Deploy"},{"id":"outlined-medium","props":{"variant":"outlined"},"content":"Deploy"},{"id":"text-medium","props":{"variant":"text"},"content":"Deploy"},{"id":"filled-small","props":{"variant":"filled","size":"small"},"content":"Deploy"},{"id":"filled-large","props":{"variant":"filled","size":"large"},"content":"Deploy"},{"id":"filled-disabled","props":{"variant":"filled","disabled":true},"content":"Deploy"},{"id":"filled-leading-icon","props":{"variant":"filled"},"content":"Create","slots":{"icon":"add"}},{"id":"filled-trailing-icon","props":{"variant":"filled","iconPosition":"trailing"},"content":"Next","slots":{"icon":"arrow_forward"}},{"id":"text-leading-icon","props":{"variant":"text"},"content":"Create","slots":{"icon":"add"}},{"id":"filled-leading-icon-small","props":{"variant":"filled","size":"small"},"content":"Create","slots":{"icon":"add"}},{"id":"filled-leading-icon-large","props":{"variant":"filled","size":"large"},"content":"Create","slots":{"icon":"add"}},{"id":"filled-trailing-icon-small","props":{"variant":"filled","size":"small","iconPosition":"trailing"},"content":"Next","slots":{"icon":"arrow_forward"}},{"id":"filled-trailing-icon-large","props":{"variant":"filled","size":"large","iconPosition":"trailing"},"content":"Next","slots":{"icon":"arrow_forward"}},{"id":"filled-icon","props":{"variant":"filled","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"tonal-icon","props":{"variant":"tonal","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"elevated-icon","props":{"variant":"elevated","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"outlined-icon","props":{"variant":"outlined","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon","props":{"variant":"text","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-small","props":{"variant":"filled","size":"small","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-large","props":{"variant":"filled","size":"large","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-small","props":{"variant":"text","size":"small","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-large","props":{"variant":"text","size":"large","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-narrow","props":{"variant":"filled","width":"narrow","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-wide","props":{"variant":"filled","width":"wide","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-narrow-small","props":{"variant":"filled","size":"small","width":"narrow","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-wide-small","props":{"variant":"filled","size":"small","width":"wide","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-narrow-large","props":{"variant":"filled","size":"large","width":"narrow","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-wide-large","props":{"variant":"filled","size":"large","width":"wide","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-narrow","props":{"variant":"text","width":"narrow","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"outlined-icon-wide","props":{"variant":"outlined","width":"wide","label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"tonal-icon-wide-selected","props":{"variant":"tonal","width":"wide","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-unselected","props":{"variant":"filled","toggle":true,"selected":false,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-selected","props":{"variant":"filled","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"tonal-icon-unselected","props":{"variant":"tonal","toggle":true,"selected":false,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"tonal-icon-selected","props":{"variant":"tonal","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"elevated-icon-unselected","props":{"variant":"elevated","toggle":true,"selected":false,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"elevated-icon-selected","props":{"variant":"elevated","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"outlined-icon-unselected","props":{"variant":"outlined","toggle":true,"selected":false,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"outlined-icon-selected","props":{"variant":"outlined","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-unselected","props":{"variant":"text","toggle":true,"selected":false,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-selected","props":{"variant":"text","toggle":true,"selected":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"tonal-leading-icon-toggle-unselected","props":{"variant":"tonal","toggle":true,"selected":false},"content":"Favorite","slots":{"icon":"favorite"}},{"id":"tonal-leading-icon-toggle-selected","props":{"variant":"tonal","toggle":true,"selected":true},"content":"Favorite","slots":{"icon":"favorite"}},{"id":"text-leading-icon-toggle-unselected","props":{"variant":"text","toggle":true,"selected":false},"content":"Favorite","slots":{"icon":"favorite"}},{"id":"text-leading-icon-toggle-selected","props":{"variant":"text","toggle":true,"selected":true},"content":"Favorite","slots":{"icon":"favorite"}},{"id":"outlined-icon-disabled","props":{"variant":"outlined","disabled":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"text-icon-disabled","props":{"variant":"text","disabled":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-icon-selected-disabled","props":{"variant":"filled","toggle":true,"selected":true,"disabled":true,"label":"Favorite"},"slots":{"icon":"favorite"}},{"id":"filled-link","props":{"variant":"filled","href":"/getting-started/"},"content":"Get started"},{"id":"outlined-link-new","props":{"variant":"outlined","href":"https://example.com/tanrei","target":"new","targetLabel":"opens in a new tab"},"content":"View source"},{"id":"tonal-link-new-leading-icon","props":{"variant":"tonal","href":"https://example.com/tanrei","target":"new","targetLabel":"opens in a new tab"},"content":"View source","slots":{"icon":"code"}},{"id":"text-link-new-rtl","props":{"variant":"text","href":"https://example.com/tanrei","target":"new","targetLabel":"opens in a new tab"},"content":"View source","direction":"rtl"},{"id":"text-icon-link","props":{"variant":"text","href":"/getting-started/","label":"Getting started"},"slots":{"icon":"arrow_forward"}},{"id":"text-icon-link-new","props":{"variant":"text","href":"https://example.com/tanrei","label":"Source code","target":"new","targetLabel":"opens in a new tab"},"slots":{"icon":"code"}},{"id":"filled-link-disabled","props":{"variant":"filled","href":"/getting-started/","disabled":true},"content":"Get started"},{"id":"outlined-link-new-disabled","props":{"variant":"outlined","href":"https://example.com/tanrei","disabled":true,"target":"new","targetLabel":"opens in a new tab"},"content":"View source"},{"id":"text-named","props":{"variant":"text","size":"small","label":"Reset: Spacing"},"content":"Reset"},{"id":"filled-leading-icon-named","props":{"variant":"filled","label":"Create a palette"},"content":"Create","slots":{"icon":"add"}},{"id":"outlined-link-named","props":{"variant":"outlined","href":"/components/button/","label":"Open the Button's page"},"content":"Open"},{"id":"filled-busy","props":{"variant":"filled","busy":true,"busyLabel":"Deploying"},"content":"Deploy"},{"id":"text-icon-busy","props":{"variant":"text","busy":true,"busyLabel":"Saving","label":"Save"},"slots":{"icon":"save"}},{"id":"filled-disabled-focusable","props":{"variant":"filled","disabled":true,"focusableWhenDisabled":true},"content":"Deploy"},{"id":"full-width","props":{"variant":"filled","fullWidth":true},"content":"Deploy"},{"id":"full-width-leading-icon","props":{"variant":"outlined","fullWidth":true},"content":"Upload","slots":{"icon":"upload"}},{"id":"filled-destructive","props":{"variant":"filled","destructive":true},"content":"Delete"},{"id":"tonal-destructive","props":{"variant":"tonal","destructive":true},"content":"Delete"},{"id":"elevated-destructive","props":{"variant":"elevated","destructive":true},"content":"Delete"},{"id":"outlined-destructive","props":{"variant":"outlined","destructive":true},"content":"Delete"},{"id":"text-destructive","props":{"variant":"text","destructive":true},"content":"Delete"},{"id":"filled-destructive-leading-icon","props":{"variant":"filled","destructive":true},"content":"Delete","slots":{"icon":"delete"}},{"id":"text-icon-destructive","props":{"variant":"text","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"filled-destructive-disabled","props":{"variant":"filled","destructive":true,"disabled":true},"content":"Delete"},{"id":"outlined-destructive-disabled","props":{"variant":"outlined","destructive":true,"disabled":true},"content":"Delete"},{"id":"filled-destructive-small","props":{"variant":"filled","size":"small","destructive":true},"content":"Delete"},{"id":"filled-destructive-large","props":{"variant":"filled","size":"large","destructive":true},"content":"Delete"},{"id":"outlined-destructive-trailing-icon","props":{"variant":"outlined","iconPosition":"trailing","destructive":true},"content":"Delete","slots":{"icon":"delete"}},{"id":"tonal-icon-destructive","props":{"variant":"tonal","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"outlined-icon-destructive","props":{"variant":"outlined","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"filled-icon-destructive-narrow","props":{"variant":"filled","width":"narrow","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"text-icon-destructive-narrow","props":{"variant":"text","width":"narrow","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"outlined-icon-destructive-wide","props":{"variant":"outlined","width":"wide","destructive":true,"label":"Delete"},"slots":{"icon":"delete"}},{"id":"filled-destructive-busy","props":{"variant":"filled","destructive":true,"busy":true,"busyLabel":"Deleting"},"content":"Delete"},{"id":"filled-destructive-full-width","props":{"variant":"filled","fullWidth":true,"destructive":true},"content":"Delete"}],"platforms":{"web":{"status":"lagging","name":"tanrei-button","props":{"variant":"variant","destructive":"destructive","size":"size","width":"width","fullWidth":"fullWidth","iconPosition":"iconPosition","toggle":"toggle","selected":"selected","disabled":"disabled","label":"label","href":"href","target":"target","targetLabel":"targetLabel","focusableWhenDisabled":"focusableWhenDisabled","busy":"busy","busyLabel":"busyLabel","value":"value"},"events":{"click":"click","change":"change"},"parts":{"container":"container","label":"label","icon":"icon","outline":"container@outline","focus-ring":"container@focus-ring"},"notes":"The label is the default slot and the icon the `icon` slot (a glyph of the icon font); an icon-only button is one whose default slot is empty. `iconPosition` is reflected as the `icon-position` attribute. `label` sets `aria-label` on the inner `<button>` (or the anchor) whenever it is not empty; with a label in the default slot the slot's text stays drawn and the attribute replaces it as the name (BTN-16), and a debug build compares the two. A toggle sets `aria-pressed` on the inner `<button>`, switches its own `selected` and fires `change`, as a native checkbox does. `width` is the `width` attribute (`default`, `narrow`, `wide`); it does nothing while the default slot holds a label. With `href` the shadow root holds an `<a part=\"container\">` in place of the `<button>`, with the same classes, parts and listeners. The link form: `href` is the `href` attribute; `target` is the `target` attribute with the values `same` and `new` (the HTML spellings `_self` and `_blank` are read as those two; anything else is `same` and reported); `targetLabel` is the `target-label` attribute. Web-only, forwarded to the anchor and to nothing else: `rel` (to which `new` adds `noopener`) and `download`. Cancelling `click` (`preventDefault()`) cancels the navigation, which is how a client-side router takes it; a modified or a middle click is the browser's. A disabled link is the anchor without `href`, with `role=\"link\"` and `aria-disabled=\"true\"`, as the navigation drawer's destination already is. Space is not handed to the press controller. `element.click()` follows the link. In a form: a form-associated custom element (`static formAssociated = true`), as the text field is, for its form owner and for a disabled fieldset (`formDisabledCallback` through the shared primitive; not while it is a link). Web attributes, not spec props, as a checkbox's `name` is: `type` (`button`, `submit`, `reset`; default `button`, reflected; anything else is `button` and reported), `form` (the id of a form, the platform's own attribute for a form-associated element) and `name`. `value` is the spec's prop: the `value` attribute and property, not reflected. The element has a read-only `form` property. A press of a submit button, after its `click` has gone through the page uncancelled, appends a hidden native `<button type=\"submit\">` with the same `name` and `value` to itself — a child in a slot it does not have, so it is drawn nowhere, naming the same form where the button names one by its `form` attribute — calls `form.requestSubmit()` with it and removes it before returning, so the form's validation, its `submit` event, `event.submitter` and `new FormData(form, event.submitter)` are the platform's, and the pair is sent at the button's own place among the form's entries, as the platform's own button's is; a reset button calls `form.reset()`. The form's default button is found by one primitive that walks `form.elements` in order and takes the first native submit button or `<tanrei-button type=\"submit\">`: the text field, the number field, the color field, the combobox, the one-time-code input and the search call it in place of `form.requestSubmit()` after their `action` (or `submit`) event, and the selection primitive of the checkbox, the radio button and the switch calls it for Enter, and for Enter in a control of the platform's own, which knows only the platform's buttons, the browser itself is left to decide: one `keydown` listener per tree, in the capture phase (on the window for a document, on the shadow root for a form inside one), added while a form of that tree holds a Tanrei submit button, answers Enter going down in a native control of such a form — inside it, or naming it by the `form` attribute from outside — whose default button is Tanrei's by appending to that button, for the length of the key, a hidden native `<button type=\"submit\">` in a slot the button does not have: the form's first submit button exactly when the Tanrei button is, disabled while it is, and never the default button to the primitive. The browser presses it exactly where, when and whether it would press a default button of its own — after the field has committed what was typed (`change`, then `click`, then `submit`), for the controls and the modifier keys this engine submits on and no others, never for the Enter an input method or a suggestion list took, and not at all while it is disabled, in a form of one field too. That press is stopped at the window before a listener of the page hears it (at the shadow root, for a form in a closed one) and its own submission cancelled; the hidden button is removed, and the Tanrei button's `click()` is called, which emits its `click` and submits as any press of it does. A hidden button the browser did not press is removed at the key's `keyup`, and one is appended again for each repeat of a key held down. A capture listener a page added to the window before the form's first Tanrei submit button was connected hears the stopped press, as a click on a hidden button inside the Tanrei button. `formaction`, `formmethod`, `formenctype`, `formtarget` and `formnovalidate` are not read. The inner `<button>` stays `type=\"button\"`: it is in a shadow root, where no form can own it. `focusableWhenDisabled` is the `focusable-when-disabled` attribute and `busyLabel` the `busy-label` attribute. A disabled button that is focusable-when-disabled renders its native `<button>` without the `disabled` attribute and with `aria-disabled=\"true\"`, and refuses the press in a listener of its own; the host's `disabled` attribute is written as for any disabled button, and a disabled fieldset still takes it out of the focus order (BTN-38). A busy button renders `aria-disabled=\"true\"` on its native `<button>` (or anchor), keeps its label and icon laid out — the label at opacity 0, still its name, and the icon also under `visibility: hidden` — faded through a transition of their opacity (the icon's visibility turning at the end of its way out and at the start of its way back), draws the arc as an inline SVG circle, and announces `busy-label` through a visually hidden `role=\"status\"` region emptied and set again each time it becomes busy (BTN-37). `fullWidth` is the `full-width` attribute: the host is a block-level flex box as wide as its container and the native `<button>` grows to fill it; while a host lays it out (a button group, a toolbar, the actions of a dialog, a popover, a callout, an empty state, a file picker) the element carries the custom state `placed` (`:state(placed)`), under which `full-width` does nothing (BTN-39). `destructive` is a boolean attribute; it draws, and exposes nothing more (BTN-42), and on a link it draws nothing (BTN-43). A toggle that a toolbar group whose selection is single makes one of its choices is told so through the group-item channel (`GroupPlace.choice`): its native `<button>` then carries `role=\"radio\"` and `aria-checked` in place of `aria-pressed` (BTN-47). BTN-5: the reach a product gives is four inherited custom properties, `--tanrei-target-cap-start`, `--tanrei-target-cap-end`, `--tanrei-target-cap-top` and `--tanrei-target-cap-bottom` (logical sides: start and end follow the direction), each a length the hit area reaches past the visible bounds on that side at most (a negative one is 0, and one larger than the side lacks of the target changes nothing); unset, a side reaches the whole target. Set on the product's container of the row they reach every button in it, so one declaration of half the row's gap stops them all; a component's own row (a button group, a toolbar, a dialog's actions, a field's own buttons) sets them on what it lays out, which is nearer and wins, and leaves `inherit` where it has no neighbour, so the product's caps reach a button group's outer ends. They are the same properties Tanrei's own rows set on what they lay out, and a button with menu reads them as a button does, for the outer side of each half."},"swiftui":{"status":"lagging","name":"TanreiButton","props":{"variant":"variant","destructive":"role","size":"size","width":"width","fullWidth":"fullWidth","iconPosition":"iconPosition","toggle":"isSelected","selected":"isSelected","disabled":"disabled","label":"label","href":"destination","target":"target","targetLabel":"targetLabel","focusableWhenDisabled":"focusableWhenDisabled","busy":"busy","busyLabel":"busyLabel","value":"value"},"events":{"click":"action","change":"isSelected"},"notes":"The title is the label and the `icon` view builder the icon; an icon-only button is the initializer that takes `label:` and an icon and no title. A toggle is the initializer that takes `isSelected: Binding<Bool>`. `disabled` follows SwiftUI's `.disabled(_:)` environment. `width: TanreiButtonWidth = .default` is a parameter of the icon-only initializer alone, so a labelled button cannot be given one. Not built on this platform yet: the initializer that takes `destination: URL` in place of `action:` (there is none that takes both a destination and `isSelected`, so a toggle cannot be given one) draws the same control as a SwiftUI `Link`, so the address is opened by the environment's `openURL` — an app that routes addresses itself provides an `OpenURLAction`, which is how the navigation is cancelled — and VoiceOver reads the link trait. `target: TanreiLinkTarget = .same` and `targetLabel` (the accessibility hint) are parameters of that initializer alone. Not built on this platform yet: the initializers that take a title take `label: String? = nil` as well, set with `.accessibilityLabel` over the title's text. SwiftUI has no form element that sends values, so there is no `type` (BTN-34): an app that wants Return to press a view's main button gives that `TanreiButton` `.keyboardShortcut(.defaultAction)`, or calls the same function from a text field's `action`. Not built on this platform yet: `busy` and `busyLabel` (BTN-36, BTN-37), and `focusableWhenDisabled` (BTN-38). Not built on this platform yet: `fullWidth` (BTN-39). Not built on this platform yet: `role: ButtonRole? = nil` on every initializer, as SwiftUI's own `Button(role:)` takes it: `.destructive` is destructive, and any other role draws as `nil` does; the role is passed on to the system, so a destructive Button in a menu, a swipe action or a confirmation dialog is treated as SwiftUI treats its own (BTN-40 to BTN-43)."},"compose":{"status":"lagging","name":"TanreiButton","props":{"variant":"variant","destructive":"destructive","size":"size","width":"width","fullWidth":"fullWidth","iconPosition":"iconPosition","toggle":"onCheckedChange","selected":"checked","disabled":"enabled","label":"contentDescription","href":"href","target":"target","targetLabel":"targetLabel","focusableWhenDisabled":"focusableWhenDisabled","busy":"busy","busyLabel":"busyLabel","value":"value"},"events":{"click":"onClick","change":"onCheckedChange"},"notes":"Compose idiom is the inverse flag `enabled`. A non-null `onCheckedChange` makes it a toggle (as `IconToggleButton`), with `checked` its state; an icon-only button is the overload with an `icon` and a `contentDescription` and no text. `width: TanreiButtonWidth = TanreiButtonWidth.Default` is a parameter of the icon-only overload alone. Not built on this platform yet: the overload that takes `href: String` and no `onCheckedChange` opens the address through `LocalUriHandler.current` after `onClick`; an app that routes addresses itself provides its own `UriHandler`. Compose has no link role for a clickable element (only link annotations inside text), so the node drops `Role.Button` and carries no role, and the README says so. `target: TanreiLinkTarget = TanreiLinkTarget.Same`; `targetLabel` is appended to the node's state description. Not built on this platform yet: the overloads that take text take `contentDescription: String? = null` as well; given, the node's semantics are cleared and set again with it, because a merged node would otherwise read the text and the description both. Compose has no form element, so there is no `type` (BTN-34): an app calls the same function from `onClick` and from a text field's `action`. Not built on this platform yet: `busy` and `busyLabel` (BTN-36, BTN-37), and `focusableWhenDisabled` (BTN-38). Not built on this platform yet: `fullWidth` (BTN-39). Not built on this platform yet: `destructive: Boolean = false` on every overload; Compose has no destructive role, so it draws and adds no semantics (BTN-40 to BTN-43)."},"flutter":{"status":"lagging","name":"TanreiButton","props":{"variant":"variant","destructive":"isDestructiveAction","size":"size","width":"width","fullWidth":"fullWidth","iconPosition":"iconAlignment","toggle":"isSelected","selected":"isSelected","disabled":"onPressed","label":"semanticLabel","href":"href","target":"target","targetLabel":"targetSemanticLabel","focusableWhenDisabled":"focusableWhenDisabled","busy":"busy","busyLabel":"busySemanticLabel","value":"value"},"events":{"click":"onPressed","change":"onPressed"},"notes":"Flutter idiom: a null `onPressed` disables the button; `iconAlignment` (start / end) is Flutter's own name for the icon's side. A non-null `isSelected` makes it a toggle and `onPressed` flips it; an icon-only button is the `TanreiButton.icon` constructor, whose `semanticLabel` is required. `width` (`TanreiButtonWidth.normal`, `.narrow`, `.wide`; `default` is a reserved word in Dart) is a parameter of `TanreiButton.icon` alone. Not built on this platform yet: the `TanreiButton.link` and `TanreiButton.iconLink` constructors (`href` is a `Uri`) has `Semantics(link: true)` with the address as its `linkUrl`. The package has no plugin dependency, so the address is opened by the nearest `TanreiLinkOpener`, an inherited widget the app provides once (calling `url_launcher`, or its own router); without one the control opens nothing and reports it in debug builds. `target` is a `TanreiLinkTarget`; `targetSemanticLabel` is the semantics hint. Not built on this platform yet: the constructors that take a child label take `semanticLabel` as well, optional there, applied with the child's own semantics excluded. Flutter's `Form` validates and saves and sends nothing, and has no default button, so there is no `type` (BTN-34): an app calls the same function from `onPressed` and from a text field's `action`. Not built on this platform yet: `busy` and `busySemanticLabel` (BTN-36, BTN-37), and `focusableWhenDisabled` (BTN-38). Not built on this platform yet: `fullWidth` (BTN-39). Not built on this platform yet: `isDestructiveAction` (`bool`, default false), the name Flutter's own `CupertinoDialogAction` gives the same flag; it draws and adds no semantics (BTN-40 to BTN-43)."},"react-native":{"status":"lagging","name":"Button","props":{"variant":"variant","destructive":"destructive","size":"size","width":"width","fullWidth":"fullWidth","iconPosition":"iconPosition","toggle":"toggle","selected":"selected","disabled":"disabled","label":"accessibilityLabel","href":"href","target":"target","targetLabel":"targetLabel","focusableWhenDisabled":"focusableWhenDisabled","busy":"busy","busyLabel":"busyLabel","value":"value"},"events":{"click":"onPress","change":"onSelectedChange"},"notes":"The label is `children` and the icon the `icon` prop; an icon-only button has no children and requires `accessibilityLabel`. A toggle has `accessibilityState.selected` and the `togglebutton` role where React Native offers it. `width` (`\"default\" | \"narrow\" | \"wide\"`) is the icon-only width, not a layout width; it is ignored with children. Not built on this platform yet: a Button with `href` has `accessibilityRole=\"link\"` and opens the address with `Linking.openURL` after `onPress`, unless `onPress` called `event.preventDefault()`. `target` is `\"same\" | \"new\"`; `targetLabel` is the `accessibilityHint`. Not built on this platform yet: `accessibilityLabel` is read with children as well as without, and replaces their text as the name. React Native has no form element, so there is no `type` (BTN-34): an app calls the same function from `onPress` and from a text field's `action`. Not built on this platform yet: `busy` and `busyLabel` (BTN-36, BTN-37), and `focusableWhenDisabled` (BTN-38). Not built on this platform yet: `fullWidth` (BTN-39). Not built on this platform yet: `destructive` (`boolean`, default false), the word React Native's own `Alert` button style uses; it draws and adds no accessibility props (BTN-40 to BTN-43)."}}}
@@ -0,0 +1 @@
1
+ {"name":"calendar","title":"Calendar","summary":"Shows one month as a grid of days, in the page or inside a picker, lets a person choose one date or one range of dates from it, and moves from month to month as one column of weeks that follows a scroll and a drag.","level":"base","listing":"default","anatomy":[{"id":"navigation-row","description":"The top row: the view toggle at the start, and the previous and next buttons at the end."},{"id":"view-toggle","description":"The displayed month and year with a chevron (expand_more). Pressing it switches between the day view and the year view. It is drawn with the unselected condition's colors."},{"id":"navigation","description":"The previous-month and next-month buttons: Tanrei icon-only Buttons of the text variant whose arrows follow the axis the months move along. They are hidden in the year view. A scroll of a wheel or a trackpad, a drag with a finger, a pen or a mouse, and Page Up and Page Down move the month too."},{"id":"weekday-row","description":"The narrow names of the seven weekdays, from the first day of the week."},{"id":"day","description":"One day in the grid (an item the calendar generates): its number on a round container that carries the day's condition and its state answer. The containers of the days inside a range join into one band. On the vertical axis the days are one unbroken column of weeks: a week two months share is one row, which a month change carries from its place in the one view to its place in the other."},{"id":"year","description":"One year of the year view (an item the calendar generates), on a container that carries the year's condition and its state answer.","optional":true},{"id":"focus-ring","description":"Gap-then-ring indicator around the container of the day, year or view toggle that has keyboard focus."}],"props":[{"name":"mode","type":"enum","values":["single","range"],"default":"single","description":"single: one date, in value. range: one contiguous span of dates, from start to end inclusive."},{"name":"value","type":"string","default":"","description":"The chosen date in single mode, as an ISO 8601 calendar date (\"2026-09-17\"); empty when none is chosen. The calendar sets it when the person chooses a day and emits change; the product may also set it. A calendar date has no time and no time zone."},{"name":"start","type":"string","default":"","description":"The first date of the chosen range in range mode, as an ISO 8601 calendar date; empty when none is chosen."},{"name":"end","type":"string","default":"","description":"The last date of the chosen range in range mode, as an ISO 8601 calendar date, never before start; empty while only start is chosen."},{"name":"min","type":"string","default":"","description":"The earliest date that can be chosen, as an ISO 8601 calendar date; empty for no limit."},{"name":"max","type":"string","default":"","description":"The latest date that can be chosen, as an ISO 8601 calendar date; empty for no limit."},{"name":"disabledDates","type":"strings","default":[],"description":"Dates inside min and max that cannot be chosen (booked, closed), as ISO 8601 calendar dates. Every platform also takes a predicate (isDateDisabled) for a rule no list can hold, such as every weekend; a day is unavailable when either says so."},{"name":"today","type":"string","default":"","description":"The date drawn as today, as an ISO 8601 calendar date. Empty uses the device's current date in its own time zone. Set it when the product's today is another (a venue's time zone, a server's date) and in tests."},{"name":"firstDayOfWeek","type":"enum","values":["locale","sunday","monday","tuesday","wednesday","thursday","friday","saturday"],"default":"locale","description":"The weekday in the first column. locale takes it from the locale (Sunday in the United States and Japan, Monday in most of Europe)."},{"name":"locale","type":"string","default":"","description":"A BCP 47 language tag (\"en-US\", \"ja-JP\") for month and weekday names, digits and the first day of the week. Empty uses the platform's current locale. The calendar is the Gregorian calendar in every locale."},{"name":"startView","type":"enum","values":["day","year"],"default":"day","description":"Whether the calendar first shows the days of a month or the list of years. year suits a date far from today, such as a birthday."},{"name":"showAdjacentDays","type":"boolean","default":false,"description":"Fills the grid's spare cells with the days of the previous and next month, drawn quieter than the month's own. Such a day can be chosen when it is available, and a range may start or end on it; choosing one also shows its month."},{"name":"label","type":"string","default":"","description":"The accessible name of the whole calendar (\"Check-in date\"). Needed when a page has more than one calendar, or when nothing near it says what the date is for. A picker that holds the calendar names it with its own label."},{"name":"startLabel","type":"string","default":"","description":"Range mode: the description of the start day, in the product's language (\"Start date\"). The product's: Tanrei has no words for it. Empty reads the product's words.","words":"startLabel"},{"name":"endLabel","type":"string","default":"","description":"Range mode: the description of the end day, in the product's language (\"End date\"). The product's: Tanrei has no words for it. Empty reads the product's words.","words":"endLabel"},{"name":"previousMonthLabel","type":"string","default":"","description":"The accessible name of the previous-month button, in the product's language (\"Previous month\"). The product's: Tanrei has no words for it. Empty reads the product's words. Required: a glyph alone is not a name.","words":"previousMonthLabel"},{"name":"nextMonthLabel","type":"string","default":"","description":"The accessible name of the next-month button, in the product's language (\"Next month\"). The product's: Tanrei has no words for it. Empty reads the product's words. Required: a glyph alone is not a name.","words":"nextMonthLabel"},{"name":"yearViewLabel","type":"string","default":"","description":"The description of the view toggle, whose name is the month and year it shows, in the product's language (\"Choose a year\"). The product's: Tanrei has no words for it. Empty reads the product's words.","words":"yearViewLabel"},{"name":"todayLabel","type":"string","default":"","description":"Read after today's date and the current year, where the platform has no property that says so (the web's aria-current), in the product's language (\"Today\"). The product's: Tanrei has no words for it. Empty reads the product's words. With neither, the platform's own word for the present day in the locale, where it has one.","words":"todayLabel"}],"items":[{"name":"day","summary":"One day in the grid. The calendar generates the days from the month, the bounds, the disabled dates and showAdjacentDays; a product and a fixture never list them.","props":[{"name":"date","type":"string","default":"","description":"The day, as an ISO 8601 calendar date."},{"name":"disabled","type":"boolean","default":false,"description":"Whether the day is unavailable: before min, after max, in disabledDates or named by isDateDisabled."},{"name":"adjacent","type":"boolean","default":false,"description":"Whether the day belongs to the previous or next month, shown because showAdjacentDays is true."}]},{"name":"year","summary":"One year of the year view, from min's year to max's year. The calendar generates them; a product and a fixture never list them.","props":[{"name":"year","type":"number","default":0,"description":"The year."}]}],"events":[{"name":"change","description":"The person chose a day that changes the choice. Carries value in single mode, or start and end in range mode (end empty after a start alone). The calendar has already set the props it carries."}],"states":["enabled","disabled","hovered","focused","pressed","selected"],"behavior":[{"id":"CAL-1","text":"THE calendar SHALL lay out, from top to bottom, the navigation row, the weekday row and six rows of seven cells, each cell a square of comp.calendar.cell.size but never smaller than sys.target.touch for touch input and sys.target.pointer for fine pointers (a platform that cannot tell the input type SHALL use sys.target.touch), because the cells are the days' hit areas and cannot extend over each other; the first day of the displayed month SHALL sit in the column of its weekday, and all six rows SHALL be kept when the month needs fewer, so that the calendar keeps its height when the month changes. The navigation row and the weekday row are each one cell tall. THE calendar SHALL draw no surface and no padding of its own: it is as wide as its seven columns, and the page or the picker that holds it gives it its background and inset."},{"id":"CAL-2","text":"THE calendar SHALL draw each day from exactly one condition, by precedence: selected for the date of single mode and for a range's start and end; in-range for a day strictly between a range's start and end; today for the date today names (or the device's current date) when it is neither; adjacent for a shown day of the previous or next month (CAL-15) when it is none of these; otherwise unselected. It SHALL draw each year of the year view from selected for the displayed year, today for the current year when it is not displayed, and otherwise unselected, and the view toggle from unselected. WHILE a day is unavailable THE calendar SHALL draw it from the disabled tokens of its condition."},{"id":"CAL-3","text":"THE calendar SHALL draw a day's number in the locale's digits, centred in its cell, in comp.calendar.day.label.typescale and the label color of its condition (comp.calendar.unselected.label.color, and so on), on a container of side comp.calendar.day.container.size centred in the cell, with comp.calendar.day.container.shape corners eased by sys.shape.corner-smoothing, in the container color of its condition, with an outline of comp.calendar.outline.width in the outline color of its condition. The container of an in-range day SHALL instead span the full width of its cell at the same height, so that the containers of consecutive in-range days join into one band that breaks at the ends of a row with square ends; WHILE a range's start and end differ each of them SHALL also draw, behind its own container, the half of its cell toward the other in comp.calendar.in-range.container.color, so that the band runs into it. The band SHALL cover every day the grid shows between start and end, and no empty cell."},{"id":"CAL-4","text":"THE calendar SHALL draw each weekday's narrow name from the locale (\"S\", \"M\" in English; \"日\", \"月\" in Japanese) centred in its column, in comp.calendar.weekday.typescale and comp.calendar.weekday.color, and SHALL expose it as a column header named by the weekday's full name; weekday names SHALL take no focus."},{"id":"CAL-5","text":"THE calendar SHALL draw the navigation row with the view toggle at the start and, in the day view, the previous-month and next-month buttons at the end, comp.calendar.navigation.gap apart, each a Tanrei Button of the text variant and the medium size with an icon and no label, named previousMonthLabel and nextMonthLabel. WHILE comp.calendar.navigation.axis is vertical their glyphs SHALL be arrow_upward and arrow_downward; WHILE it is horizontal they SHALL be arrow_back for the previous month and arrow_forward for the next in every layout direction, pointing toward the start and the end: in a right-to-left layout the icon helper mirrors both, because the icon set marks them as mirrored, and the calendar SHALL NOT exchange the two names or mirror a glyph itself. The previous button SHALL be disabled while the displayed month is min's month and the next button while it is max's month, and in the year view both SHALL be hidden. THE calendar SHALL NOT change the buttons' variant, size or tokens."},{"id":"CAL-6","text":"THE calendar SHALL draw the view toggle as a container at least comp.calendar.view-toggle.container.height tall with comp.calendar.view-toggle.container.shape corners eased by sys.shape.corner-smoothing, padded by comp.calendar.view-toggle.container.padding-inline at each end, holding the displayed month and year in the locale's form (\"September 2026\", \"2026年9月\") in comp.calendar.view-toggle.label.typescale and, comp.calendar.view-toggle.gap after it, the expand_more glyph at comp.calendar.view-toggle.icon.size with the family and fill of an unselected icon, sys.icon.weight and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max, both in comp.calendar.unselected.label.color on comp.calendar.unselected.container.color; the glyph SHALL be turned half a turn while the year view is shown, over comp.calendar.motion.state-duration with comp.calendar.motion.state-easing (at once where motion is reduced). WHERE the view toggle is shorter than the minimum target it SHALL extend its hit area to sys.target.touch for touch input and sys.target.pointer for fine pointers without changing its visual size; WHILE the year view is shown that hit area SHALL reach toward the first row of years, whose cells begin where the navigation row ends, no further than halfway across the space between the view toggle's visible bounds and that row, so that a press on a year, or in the nearer half of that space, goes to the year. WHEN it is activated it SHALL switch between the day view and the year view."},{"id":"CAL-7","text":"WHEN the year view is shown THE calendar SHALL draw, in the space of the weekday row and the six rows of days, the years from min's year to max's year (1900 to 2100 when min or max is empty) in rows of three cells, each a third of the grid's width and comp.calendar.cell.size tall, each year centred in its cell in the locale's digits in comp.calendar.year.label.typescale on a container of comp.calendar.year.container.width by comp.calendar.year.container.height with comp.calendar.year.container.shape corners, colored and outlined as a day of its condition is; the list SHALL scroll, and SHALL open scrolled so that the displayed year's row is the third row in view, or as near to it as the list's ends allow. WHEN the user chooses a year THE calendar SHALL show the day view of the month with the displayed month's number in that year, clamped between min's and max's months, move focus to its active day and SHALL NOT change the choice; WHEN the view toggle is activated in the year view it SHALL show the day view unchanged."},{"id":"CAL-8","text":"WHILE mode is single, WHEN the user chooses an available day by pointer, touch, Enter or Space THE calendar SHALL set value to it and, if it differs from the value before, emit change once with it."},{"id":"CAL-9","text":"WHILE mode is range, WHEN the user chooses an available day THE calendar SHALL make it the start and clear the end when no start is chosen, when both are chosen, or when the day is before the start, and otherwise SHALL make it the end (a start and end on the same day make a one-day range); after each choice it SHALL set start and end and emit change once with both, end empty after a start alone. A range SHALL be one contiguous span from start to end inclusive; unavailable days between them SHALL stay inside it, drawn and exposed as unavailable (a product that cannot accept such a span says so after change)."},{"id":"CAL-10","text":"THE calendar SHALL give the day grid one tab stop, the active day: WHEN a month is shown the active day SHALL be the chosen date (single mode) or start (range mode) when it lies in that month, otherwise today when it does, otherwise the first available day of the month, otherwise its first day; only the active day SHALL take focus from Tab, and the keys of CAL-11 move it."},{"id":"CAL-11","text":"WHILE focus is on a day THE calendar SHALL move the active day and focus with Right Arrow and Left Arrow one day in the direction the arrow points (the next and the previous day left to right, the previous and the next right to left), with Down Arrow and Up Arrow one week later and earlier, with Home and End to the first and last day of its week row, with Page Down and Page Up to the same day of the next and previous month (the last day of that month when it is shorter), and with Shift+Page Down and Shift+Page Up to the same day of the next and previous year, whatever comp.calendar.navigation.axis is; WHEN the new active day lies in another month THE calendar SHALL show that month; it SHALL NOT move the active day before min or after max; unavailable days SHALL be reachable but SHALL NOT be chosen; Enter and Space SHALL choose the active day."},{"id":"CAL-12","text":"WHILE focus is in the year view THE calendar SHALL give the list one tab stop, the displayed year, and SHALL move focus with Right Arrow and Left Arrow one year in the direction the arrow points, with Down Arrow and Up Arrow one row, and with Home and End to the first and last year, scrolling the focused year into view; Enter and Space SHALL choose the focused year (CAL-7)."},{"id":"CAL-13","text":"WHEN the previous-month or next-month button is activated, a step of a detented wheel moves the month (CAL-33), a scroll or a drag ends on another month than the one shown when it began (CAL-34, CAL-31) or a day of a neighbouring month is chosen (CAL-15), THE calendar SHALL show that month, keep focus where it was, make the active day the same day number of the new month (its last day when the month is shorter; the chosen day, WHEN a day was chosen) and announce the new month and year once, politely; WHEN a year is chosen in the year view it SHALL announce the month and year it shows the same way. A month that a scroll only passes through is shown without an announcement (CAL-34)."},{"id":"CAL-14","text":"WHEN the displayed month changes by a button, a key, a step of a detented wheel (CAL-33) or a chosen day THE calendar SHALL play the change over comp.calendar.motion.page-duration with comp.calendar.motion.page-easing: WHILE comp.calendar.navigation.axis is vertical as one continuous scroll of the weeks, every frame of it being the in-between look of CAL-29 at the progress the easing gives, so that the two months are never drawn as two separate grids and a week they share is neither drawn twice nor replaced; WHILE the axis is horizontal as two pages, the old month's grid sliding out toward the start and the new one in from the end for a later month, and the reverse for an earlier one. Every way of moving the month SHALL move the same thing — on the vertical axis the one progress of CAL-29, on the horizontal one the place of the two pages — and none SHALL have a look of its own: a scroll of a wheel or a trackpad is followed as CAL-33 says and settles as CAL-34 says, and a drag is followed as CAL-30 says and settles as CAL-31 says. WHEN one of them begins while the days are still moving — a month change is playing, or the days are settling after a scroll or a drag — THE calendar SHALL carry on from what is on screen, without a jump and without waiting for the motion to end. WHEN it switches between the day view and the year view it SHALL cross-fade them over the same duration and easing; WHERE motion is reduced it SHALL make all of these changes at once. The weekday row, the navigation row and the calendar's size SHALL NOT move."},{"id":"CAL-15","text":"WHILE showAdjacentDays is true THE calendar SHALL fill the cells before the displayed month's first day and after its last with the days of the previous and next month, in order, drawn from the adjacent condition unless a higher one applies (CAL-2), and treated as any day for availability (CAL-16), choosing (CAL-8, CAL-9) and the range's band (CAL-3); WHEN the user chooses such a day by pointer or touch THE calendar SHALL choose it as any day, emitting change as CAL-8 and CAL-9 say, and SHALL then show that day's month (CAL-13) with the motion of CAL-14, where the chosen day is one of the month's own and the active day, taking focus if focus was in the grid; a range's start and its end SHALL both do so. A press on an unavailable one SHALL choose nothing and show no other month. WHILE showAdjacentDays is false those cells SHALL be empty, take no press and be hidden from assistive technology."},{"id":"CAL-16","text":"THE calendar SHALL treat as unavailable every day before min, after max, listed in disabledDates or named by the platform's isDateDisabled predicate. WHILE a day is unavailable THE calendar SHALL render its container, label, outline and opacity from the disabled tokens of its condition (comp.calendar.unselected.container.color at rest, and so on), SHALL NOT make it the chosen date, start or end, SHALL expose it to assistive technology as unavailable (disabled), and SHALL keep it reachable by the arrow keys. WHEN value, start or end names an unavailable day THE calendar SHALL still draw it as chosen, from the disabled tokens of the selected condition, until the person chooses another."},{"id":"CAL-17","text":"WHEN the calendar is first shown THE calendar SHALL show the month of value or start, otherwise of today, clamped between min's month and max's month, or the year view WHERE startView is year; WHEN the product sets value, start or end to a date outside the displayed month THE calendar SHALL show that date's month, without the motion of CAL-14."},{"id":"CAL-18","text":"WHILE a day, a year or the view toggle is hovered, keyboard-focused or pressed THE calendar SHALL render its container, label, outline and opacity from the component tokens of its condition in the highest-precedence active state, with precedence pressed over focused over hovered; focus gained by pointer or touch SHALL NOT select the focused state. WHEN these colors change between states THE calendar SHALL animate them over comp.calendar.motion.state-duration with comp.calendar.motion.state-easing, and SHALL change them at once where motion is reduced."},{"id":"CAL-19","text":"WHEN a day, a year or the view toggle receives keyboard focus THE calendar SHALL show the focus ring around its container — around the circle of comp.calendar.day.container.size for every day, an in-range day included — without animation; focus gained by pointer or touch SHALL NOT show it. A day, a year or the view toggle that has focus SHALL become keyboard-focused WHEN a key works it — Enter or Space, or a key that moves focus to it (CAL-11, CAL-12) — however focus first reached it. WHEN the product moves focus to the calendar and says whether that focus is to show the ring — as a date-time picker does as it opens (DTM-3), from how it was opened — THE calendar SHALL show the ring or not as it says, also on a day or a year that has focus already, whatever the platform would draw for a focus given that way."},{"id":"CAL-20","text":"WHEN the calendar's day, year or view toggle is pressed by pointer, touch, Enter or Space THE calendar SHALL show the pressed state without delay and SHALL keep it visible for at least sys.motion.duration.press-hold, even when the press ends sooner."},{"id":"CAL-21","text":"WHILE pressed THE calendar's day, year or view toggle SHALL answer as sys.behavior.pressed-feedback names: overlay applies the pressed tokens to the whole container at once; ripple grows the pressed state layer from the point of contact (from the center for keyboard activation); dim applies the pressed opacity to the whole control and draws no state layer; none draws no answer to the press. Under ripple and dim only the container color stays with the state under the press; label, outline, opacity and shape still come from the pressed tokens. Under none every part stays with the state under the press. The ripple grows over comp.calendar.motion.feedback-duration with comp.calendar.motion.state-easing, fades over comp.calendar.motion.state-duration with comp.calendar.motion.state-easing once the press has ended and press-hold has passed, and appears whole where motion is reduced."},{"id":"CAL-22","text":"THE calendar's day, year and view toggle SHALL ease their container corners by sys.shape.corner-smoothing (0 is a quarter circle, 0.6 the iOS continuous corner; a platform with only the OS curve draws it for any amount above 0) and show their keyboard focus as sys.behavior.focus-style names (ring or glow); a platform that cannot draw a choice SHALL fall back to the first value and state that in its README."},{"id":"CAL-23","text":"THE calendar SHALL expose itself as a group named by label while label is not empty, the day grid as a grid named by the displayed month and year with the weekday names as its column headers, and each shown day as a cell that can be activated, named by its full date in the locale (\"Thursday, September 17, 2026\") followed by todayLabel for today where the platform has no property for the current date, with its selected state (true for the chosen date and for every day of a range), described by startLabel or endLabel for a range's start and end, and with its disabled state while unavailable; empty cells SHALL be hidden. It SHALL expose the view toggle as a button named by its visible month and year, described by yearViewLabel, with its expanded state (true while the year view is shown), and each year as a button with its selected state and todayLabel for the current year."},{"id":"CAL-24","text":"THE calendar SHALL take month and weekday names, digits and the locale's first day of the week from locale, or from the platform's current locale while locale is empty, and SHALL use firstDayOfWeek instead of the locale's while it is not locale; WHERE the platform has no week data for the locale it SHALL use the first days of CLDR's weekData, which the platform package embeds. Every date SHALL be a Gregorian calendar date without a time or a time zone, and WHILE today is empty THE calendar SHALL read the device's current date in its own time zone WHEN it is first shown and WHEN the date changes while it is shown."},{"id":"CAL-25","text":"THE calendar's days, years, weekday names and view toggle SHALL grow with enlarged text rather than clip it: a day's container SHALL grow to hold its number. WHERE the space given to the calendar is narrower than seven minimum targets, the cells SHALL narrow equally so that the grid fits it, keeping their numbers at their size, and the calendar SHALL never be wider than the space it is given."},{"id":"CAL-26","text":"WHEN the layout direction is right-to-left THE calendar SHALL mirror its layout — the first day of the week in the rightmost column, the view toggle at the right and the navigation buttons at the left, and, on the horizontal axis, the slide of CAL-14 and the side each neighbouring month lies on (the next month toward the left, so that a drag toward the right brings it, CAL-30) — and SHALL NOT mirror the vertical scroll of the weeks, a vertical drag or the vertical arrows. A drag SHALL move the days where the pointer goes, and a scroll of a wheel or a trackpad SHALL move them where it moves the content of a scrolled list, in every layout direction."},{"id":"CAL-27","text":"WHEN mode, startView or firstDayOfWeek names a value the calendar does not define THE calendar SHALL behave as its default value and in debug builds report the unknown value; WHEN value, start, end, min, max, today or an entry of disabledDates is not an ISO 8601 calendar date, end is before start, value is set in range mode or start or end in single mode THE calendar SHALL ignore it and in debug builds report it; WHEN min is later than max THE calendar SHALL ignore both and report it in debug builds."},{"id":"CAL-28","text":"THE calendar SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the calendar is shown THE calendar SHALL draw itself for the new direction at once, without a motion of its own, keeping the displayed month, the selection and its focus."},{"id":"CAL-29","text":"WHILE comp.calendar.navigation.axis is vertical THE calendar SHALL treat the days as one unbroken column of week rows, in which a month's view is the six rows from the row of its first day, and SHALL draw every look between the views of two neighbouring months from one progress, 0 at the one and 1 at the other, with no threshold. The rows SHALL be offset along the column by the progress times the distance between the two views' first rows (four or five rows, each comp.calendar.cell.size tall) and clipped to the grid's six rows, so that a week the two views share is one row that travels from its place in the one to its place in the other. Every day SHALL be drawn at the linear interpolation by the progress between what the one view draws for it and what the other draws: its container, label and outline colors between the tokens of the adjacent condition and those of the unselected condition (comp.calendar.adjacent.label.color and comp.calendar.unselected.label.color, and so on, in the state the day is in) WHERE it is a neighbouring month's day in the one view and the month's own in the other (CAL-2), and its opacity between 1 where a view draws it and 0 where a view does not — a row outside that view's six, or a cell that view leaves empty because showAdjacentDays is false — so that a day coming into view fades in and a day leaving it fades out as far as the weeks have moved. A day that both views draw alike SHALL NOT change, and the band of a range (CAL-3) SHALL follow the same rule, each piece with its day. WHERE the two months are not neighbours (a step of a year, CAL-11; a date the keys reach in a further month) the distance SHALL be six rows, as if the later month's view began where the earlier one's ends."},{"id":"CAL-30","text":"WHILE the day view is shown, WHEN the user presses the day grid with touch, a pen or the primary button of a mouse and drags past the platform's touch slop (8 points where the platform names none, for every kind of pointer), further along the axis comp.calendar.navigation.axis names than across it, THE calendar SHALL take the drag: the press SHALL choose no day when it ends (CAL-8, CAL-9), the day under it SHALL leave its pressed state as it does when a press ends (CAL-20), and from then until the drag ends THE calendar SHALL move the days by the distance the pointer has travelled along the axis since the press, in the frame the pointer moves and without a motion of its own — toward the next month for a drag toward the top (vertical) or the start (horizontal), toward the previous month for the reverse — never further than the view of the month next to the displayed one, and never past min's or max's month, where the days SHALL stop. WHILE the axis is vertical THE calendar SHALL draw the in-between look of CAL-29 at the progress that travel gives (the travel over the distance between the two views), so that the scroll of the weeks, the fading in of the days coming into view and the change of a neighbouring month's day into one of the month's own all follow the pointer continuously; WHILE the axis is horizontal the two pages of CAL-14 SHALL travel with the pointer, side by side. A press that ends before it has passed the slop SHALL choose the day under it as CAL-8 and CAL-9 say, with every kind of pointer, so that a click of a mouse on a day still chooses it. WHILE a drag the calendar has taken lasts, THE calendar SHALL follow the pointer wherever it goes, outside the grid and the calendar included; no day SHALL be drawn hovered; nothing the calendar draws SHALL be selected as text or picked up by the platform's drag and drop; and a fine pointer SHALL show the platform's cursor for something held and dragged (grabbing) until the drag ends. At rest the cursor over a day SHALL stay the one a pressable day shows: the grid does not advertise the drag, which is a shortcut. A press of another mouse button SHALL take no drag. A drag that is further across the axis than along it when it passes the slop SHALL be left to the scrolling ancestor for its whole length; a scroll of a wheel or a trackpad is followed as CAL-33 says."},{"id":"CAL-31","text":"WHEN the user releases a drag the calendar has taken THE calendar SHALL choose one month: the neighbouring month the days have moved toward WHERE they are a quarter or more of the distance from the displayed month's view toward its view, and otherwise the displayed month — the same quarter that ends a scroll (CAL-34) — or, WHEN the release is a fling along the axis, the one of the two the fling is toward; a fling is a release faster than the platform's minimum fling velocity (Android's ViewConfiguration.getScaledMinimumFlingVelocity, Flutter's kMinFlingVelocity) or, where the platform names none (the web, SwiftUI, React Native), 0.5 points per millisecond, with every kind of pointer. A release's velocity is the pointer's over its last moves: WHERE the pointer has not moved for longer than the time after which the platform's velocity tracker takes a pointer as stopped (40 milliseconds in Android's VelocityTracker, Jetpack Compose's VelocityTracker and Flutter's VelocityTracker) or, where the platform names none (the web, SwiftUI, React Native), 40 milliseconds before the release THE calendar SHALL take the release as having no velocity, so that a drag that stops where it is wanted and is let go there is no fling, however fast it moved before it stopped. WHERE the chosen month is not the displayed one THE calendar SHALL show it as CAL-13 says and bring the days from where the release left them to its view over comp.calendar.motion.page-duration with comp.calendar.motion.page-easing; WHERE it is the displayed month THE calendar SHALL return them over the same motion and announce nothing. The quarter decides only what a release chooses; nothing drawn changes at it. The release SHALL NOT also choose the day under the pointer, and a drag SHALL never change value, start or end, nor emit change."},{"id":"CAL-32","text":"WHEN a drag the calendar has taken is cancelled — the platform cancels the pointer (a system gesture, a lost capture), Escape is pressed while it lasts, the product sets value, start or end (CAL-17), or the year view is shown — THE calendar SHALL return the days to the view of the displayed month (the month the product's date has just named, where it named one) over comp.calendar.motion.page-duration with comp.calendar.motion.page-easing and announce nothing; WHEN the product sets value, start or end, or the year view is shown, while a scroll is being followed THE calendar SHALL do the same and SHALL ignore what is left of that scroll (CAL-34). WHILE a drag or a scroll holds the days between two views THE calendar SHALL NOT change the month and year that the view toggle and the grid's name show, the active day, keyboard focus or what it exposes to assistive technology: the days of the month coming into view SHALL be hidden from assistive technology and take no focus and no press until that month is the displayed one, which it becomes by the release that chooses it (CAL-31), by the end of the scroll that chooses it or by the scroll reaching its view (CAL-34). WHERE motion is reduced THE calendar SHALL still move the days with the pointer and with the scroll and draw the in-between look, which the person's own hand moves, and SHALL put them at the chosen month's view at once when the drag is released or cancelled or the scroll ends."},{"id":"CAL-33","text":"WHILE the day view is shown, WHEN a wheel or a trackpad scrolls over the day grid further along the axis comp.calendar.navigation.axis names than across it, THE calendar SHALL take the scroll and move the days by the distance the scroll reports, one point for each point and in the frame it arrives, as the content of a scrolled list moves — toward the next month for a scroll toward the bottom (vertical) or toward the end (horizontal), toward the previous month for the reverse — without a motion of its own and with no least amount: the slightest scroll moves the days by that much and no further. WHILE the axis is vertical THE calendar SHALL draw the in-between look of CAL-29 at the progress that travel gives; WHILE it is horizontal the two pages of CAL-14 SHALL travel side by side. A scroll that goes on SHALL go on through month after month: WHEN the days reach the view of the neighbouring month THE calendar SHALL make that month the displayed one (CAL-34) and carry on toward the month after it with the distance that is left, in the same frame, so that a scroll never waits for an earlier one to end and no part of it is dropped. The days SHALL stop at the view of min's or max's month; a scroll along the axis that can move them no further SHALL still be the calendar's and SHALL NOT be passed on to a scrolling ancestor. A scroll further across the axis than along it SHALL be left to the scrolling ancestor, and so SHALL a scroll that zooms (a pinch on a trackpad, a wheel turned with the platform's zoom key). WHERE the platform reports a scroll as steps of a detented wheel and not as a distance (a delta in lines or pages on the web; a mouse wheel's notch where the platform tells it from a trackpad), each step SHALL instead move one month, as a press of the previous or next button does (CAL-13, CAL-14), one step after another without waiting for the motion to end."},{"id":"CAL-34","text":"THE calendar SHALL take a scroll it follows (CAL-33) as ended WHEN the platform says that it has ended, its momentum included, where the platform reports that; where it does not (the web), WHEN no scroll event has arrived for 150 milliseconds, or WHEN the scroll has slowed below 0.1 points per millisecond, measured over its events of the last 100 milliseconds — the tail of a momentum scroll, which need not be waited out: THE calendar SHALL then ignore the events that follow for as long as they are no faster than that, until a faster one arrives or 150 milliseconds pass without any. WHEN a scroll ends with the days between two views THE calendar SHALL choose one of the two — the neighbouring month WHERE the days are a quarter or more of the distance from the displayed month's view toward its view, and otherwise the displayed month, so that a slight scroll returns and a deliberate one need not reach halfway — and SHALL bring the days to the chosen view over comp.calendar.motion.page-duration with comp.calendar.motion.page-easing (at once where motion is reduced, CAL-32). The displayed month SHALL be the month whose view the days last rested on or reached: WHEN a scroll that goes on reaches a neighbouring month's view THE calendar SHALL show that month in the view toggle and the grid's name at once, make its days the ones that take focus and presses, and move the active day and a focused day as CAL-13 says, but SHALL announce nothing yet; the quarter is then counted from that view. THE calendar SHALL announce the month and year once, politely, WHEN a scroll has ended and the days have been given their view, and only WHERE that month is not the one that was displayed when the scroll began; a scroll that returns SHALL announce nothing. WHEN a faster scroll event arrives, a drag is taken or a button or a key moves the month while the days are settling THE calendar SHALL carry on from what is on screen (CAL-14). A scroll SHALL never change value, start or end, nor emit change."},{"id":"CAL-35","text":"THE calendar SHALL have no words of its own: it SHALL take startLabel, endLabel, previousMonthLabel, nextMonthLabel, yearViewLabel and todayLabel from the instance's prop and, WHILE that is empty, from the product's words of the same name; WHILE neither gives todayLabel it SHALL take the word from the platform's locale data WHERE the platform has the locale's own word for the present day, and it SHALL take no other word from anywhere. IF neither gives a navigation button its name, or a range's start or end its description, THE calendar SHALL still draw the part and keep it working, and in debug builds SHALL report the missing words once, naming the prop. WHILE neither gives yearViewLabel the view toggle SHALL have no description: its name and its expanded state (CAL-23) still say what it shows."},{"id":"CAL-36","text":"WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE calendar SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on its group, which it SHALL be WHILE it has a name: its label, or one given so — an id reference by the elements it names in the host's tree or a tree around it, a description after its own. WHILE label is not empty it is the group's name, over a name given so. WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE calendar SHALL take it off that element."},{"id":"CAL-37","text":"WHEN the control height (dial.control.height) is N THE calendar's view toggle and a year's container SHALL be N tall: the view toggle of CAL-6 SHALL be drawn at comp.calendar.view-toggle.container.height and a year's container of CAL-7 at comp.calendar.year.container.height, each sys.control.height.medium held at sys.target.minimum, as a day's container is drawn at comp.calendar.day.container.size (CAL-3), so that the navigation row's controls stand as tall as its previous and next Buttons, which follow the control height as theirs do. The cell (comp.calendar.cell.size) is the pitch of the grid and no control on a row: it holds a touch target for every day and every row of years, because cells cannot extend a hit area over each other (CAL-1), as Material draws a 40 day in a 48 cell; it SHALL keep its own size at every control height, and the navigation row SHALL stay one cell tall."}],"accessibility":{"role":"group","keyboard":[{"keys":"Tab / Shift+Tab","action":"Moves through the view toggle, the previous and next buttons and the active day (or the displayed year)."},{"keys":"Arrow keys","action":"Move the active day by one day (Left and Right, in the direction the arrow points) or one week (Up and Down), changing the month as needed, whatever axis the months move along; in the year view, by one year or one row."},{"keys":"Home / End","action":"The first or last day of the week row; the first or last year."},{"keys":"Page Up / Page Down","action":"The same day of the previous or next month."},{"keys":"Shift+Page Up / Shift+Page Down","action":"The same day of the previous or next year."},{"keys":"Enter or Space","action":"Choose the active day or the focused year; activate the focused button."}],"labeling":"The calendar is a group named by label when it has one. The grid is named by the month and year it shows and its column headers are the weekdays' full names. Each day is named by its full date in the locale, with todayLabel after today's where the platform has no current-date property, and exposes its selected and disabled states; a range's start and end are described by startLabel and endLabel. The view toggle is named by its visible month and year, described by yearViewLabel, and exposes whether the year view is expanded. The navigation buttons are named by previousMonthLabel and nextMonthLabel.","minimumTarget":true,"notes":["The cells are the days' hit areas and are never smaller than the minimum target (CAL-1); the view toggle extends its hit area (CAL-6). The navigation buttons are Tanrei Buttons, which meet the target themselves (BTN-5).","Unavailable days stay reachable by the arrow keys, as the WAI-ARIA date picker dialog pattern recommends, so a screen-reader user learns that a date exists and cannot be chosen.","Scrolling and dragging to move the month are pointer and touch shortcuts, with a finger, a pen, a mouse, a wheel or a trackpad. The buttons and Page Up / Page Down do the same, so nothing depends on a gesture, and a drag is never the only way (WCAG 2.5.7). While a drag lasts nothing the calendar exposes changes; while a scroll goes on through several months the title follows each month it reaches, but the month is announced once, when the scroll or the release has chosen it (CAL-31, CAL-32, CAL-34), so a screen reader is not read every month that passes.","A scroll along the calendar's axis is the calendar's while the pointer is over the day grid (CAL-33): a page that scrolls the same way does not scroll from there. The weekday row, the navigation row and everything around the calendar scroll the page as usual, and a calendar with a horizontal axis leaves the page's vertical scroll alone.","A day of a neighbouring month that is chosen by pointer brings its month into view (CAL-15), announced as any month change is. The keys never need it: the arrow keys show a day's month before Enter can choose it (CAL-11).","Typing a date is the Text field's job, not the calendar's: a product that wants both puts a Text field beside it, or uses a DateTimePicker opened from the field's trailing button. Typing is the fastest route for many people and the most direct one for screen reader users.","The calendar has no words of its own. Month and weekday names, digits and date forms are the platform's locale data, in the locale the calendar was given. Every other word it shows or announces is the product's: a prop of this instance, or the product's words set once.","The web exposes the grid with role grid, rows, column headers and gridcells with aria-selected and aria-disabled, and today with aria-current=\"date\" (so todayLabel is not added there). The platforms without a grid role expose the rows and columns through their collection semantics where they have them (Compose's collection info), and otherwise each day as a button in reading order.","How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves."]},"tokens":"comp.calendar","fixtures":[{"id":"single","props":{"value":"2026-09-17","today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}},{"id":"empty","props":{"today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}},{"id":"range","props":{"mode":"range","start":"2026-09-10","end":"2026-09-16","today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today","startLabel":"Start date","endLabel":"End date"}},{"id":"range-start","props":{"mode":"range","start":"2026-09-10","today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today","startLabel":"Start date","endLabel":"End date"}},{"id":"monday","props":{"value":"2026-09-17","today":"2026-09-24","locale":"en-US","firstDayOfWeek":"monday","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}},{"id":"ja","props":{"value":"2026-09-17","today":"2026-09-24","locale":"ja-JP","previousMonthLabel":"前の月","nextMonthLabel":"次の月","yearViewLabel":"年を選択","todayLabel":"今日"}},{"id":"unavailable","props":{"value":"2026-09-12","min":"2026-09-03","max":"2026-09-22","disabledDates":["2026-09-12"],"today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}},{"id":"range-unavailable","props":{"mode":"range","start":"2026-09-10","end":"2026-09-16","disabledDates":["2026-09-13"],"today":"2026-09-24","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today","startLabel":"Start date","endLabel":"End date"}},{"id":"adjacent-days","props":{"value":"2026-09-17","today":"2026-09-24","locale":"en-US","showAdjacentDays":true,"previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}},{"id":"adjacent-days-range","props":{"mode":"range","start":"2026-09-28","end":"2026-10-02","today":"2026-09-24","locale":"en-US","showAdjacentDays":true,"previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today","startLabel":"Start date","endLabel":"End date"}},{"id":"year","props":{"startView":"year","value":"2026-09-17","today":"2027-01-15","locale":"en-US","previousMonthLabel":"Previous month","nextMonthLabel":"Next month","yearViewLabel":"Choose a year","todayLabel":"Today"}}],"platforms":{"web":{"status":"lagging","name":"tanrei-calendar","props":{"mode":"mode","value":"value","start":"start","end":"end","min":"min","max":"max","disabledDates":"disabledDates","today":"today","firstDayOfWeek":"firstDayOfWeek","locale":"locale","startView":"startView","showAdjacentDays":"showAdjacentDays","label":"label","startLabel":"startLabel","endLabel":"endLabel","previousMonthLabel":"previousMonthLabel","nextMonthLabel":"nextMonthLabel","yearViewLabel":"yearViewLabel","todayLabel":"todayLabel"},"events":{"change":"change"},"items":{"day":{"name":"renderDay","props":{"date":"date","disabled":"disabled","adjacent":"adjacent"},"notes":"A gridcell button in the shadow root with `part=\"day\"`, `data-date` and, for a day of the neighbouring month, `data-adjacent`, rendered by `renderDay`."},"year":{"name":"renderYear","props":{"year":"year"},"notes":"A button in the shadow root with `part=\"year\"`, rendered by `renderYear`."}},"notes":"Attributes are kebab-case (`disabled-dates` is a space-separated list of ISO dates, `first-day-of-week`, `start-view`, `show-adjacent-days`, `start-label`, …); `isDateDisabled` is a property only (a function from an ISO date string to a boolean). `value`, `start` and `end` are set before `change` fires, as a native control does. The navigation buttons are `<tanrei-button variant=\"text\">` elements with a slotted glyph and no label, in the shadow root. The calendar is not form-associated: the product's field is. A vertical axis reads `wheel` events with `deltaY` and a horizontal axis `deltaX`: a delta in pixels (`deltaMode` 0) is a distance and is followed point for point (CAL-33), a delta in lines or pages is a step of one month; an event with `ctrlKey` is a zoom and is left alone. The web reports neither the end of a scroll nor its momentum, so a scroll ends by the 150 ms of silence or the slow-down of CAL-34, and a mouse wheel that the browser reports in pixels is followed as a distance like a trackpad (the web cannot tell them apart). Drags of touch, a pen and a mouse's primary button are followed along the axis (pointer events with `setPointerCapture` once the drag is taken; `touch-action: pan-x` on a vertical grid and `pan-y` on a horizontal one, so the page keeps its pan across it); while a drag is taken the grid shows `cursor: grabbing`, draws no hover, and the `click` that follows the release chooses nothing. On the vertical axis the day grid is one keyed list of week rows — the rows of the displayed month and, while a change plays or a drag lasts, those of the month it moves toward — offset by one custom property for the progress (CAL-29), which a drag and a scroll write in each frame and a button's change and a settle transition; a day's colors are mixed by that progress with `color-mix()` and its opacity follows it, so a shared week is one element throughout. The rows coming into view are `inert` and `aria-hidden` until their month is the displayed one. The slop is 8 points for every pointer and a fling 0.5 points per millisecond, as the tabs' and the sheets'. The axis is read from the resolved comp.calendar.navigation.axis custom property once per system. Locale data comes from `Intl.DateTimeFormat` and `Intl.Locale`'s week info where the browser has it; otherwise the embedded CLDR table. Without `locale` it reads the nearest `lang` attribute, then `navigator.language`. Snapshot harness: the element on a 400 × 440 stage of the surface color (CAL-1's verify). Words: the element has no words of its own. `start-label`, `end-label`, `previous-month-label`, `next-month-label`, `year-view-label` and `today-label` left empty read the product's words, set once with `setWords()` from `@tanrei/web`; the element draws again when they change. The present day's word, where neither the instance nor the product gives one, is `Intl.RelativeTimeFormat(locale, { numeric: \"auto\" }).format(0, \"day\")`. `focus()` moves focus to the active day, or the displayed year in the year view; given `focusVisible`, the ring shows or not as it asks (CAL-19), also where the browser does not read the option (Chromium before 145, Safari before 18.4): the calendar draws the ring of a day, a year and the view toggle itself, from how focus arrived and the keys that worked it."},"swiftui":{"status":"planned","name":"TanreiCalendar","props":{"mode":"range","value":"selection","start":"range","end":"range","min":"minDate","max":"maxDate","disabledDates":"disabledDates","today":"today","firstDayOfWeek":"firstDayOfWeek","locale":"locale","startView":"startView","showAdjacentDays":"showsAdjacentDays","label":"label","startLabel":"startLabel","endLabel":"endLabel","previousMonthLabel":"previousMonthLabel","nextMonthLabel":"nextMonthLabel","yearViewLabel":"yearViewLabel","todayLabel":"todayLabel"},"events":{"change":"selection"},"items":{"day":{"name":"TanreiCalendarDay","props":{"date":"date","disabled":"disabled","adjacent":"isAdjacent"}},"year":{"name":"TanreiCalendarYear","props":{"year":"year"}}},"notes":"Planned. A view: `TanreiCalendar(selection: Binding<DateComponents?>, …)` for a date and `TanreiCalendar(range: Binding<TanreiDateRange>, …)` for a range, where `TanreiDateRange` holds `start` and `end` as `DateComponents?`; the initializer is the mode. Dates are `DateComponents` with year, month and day in the Gregorian calendar, so no time zone enters. Writing the binding is change. `minDate`, `maxDate`, `today` and `disabledDates` (`Set<DateComponents>`) take `DateComponents`; `isDateDisabled` is a closure. The words are fields of a `TanreiCalendarLabels` passed as `labels:`, whose field names are the spec's; `label` is the view's own. `locale` defaults to the `\\.locale` environment. Arrow keys through `.onKeyPress`; the drag of CAL-30 through a `DragGesture(minimumDistance:)` on the axis whose `predictedEndTranslation` gives the fling, which a mouse drives on macOS and iPadOS as a finger does; on macOS the scroll through an `NSEvent` monitor, whose `phase` and `momentumPhase` say when a scroll ends (CAL-34) and whose `hasPreciseScrollingDeltas` tells a trackpad's distance from a wheel's steps (CAL-33). On the vertical axis the weeks are one column offset by an animatable progress (`animatableData`), not two pages (CAL-29). The navigation buttons are `TanreiButton`s with an icon and no label. Built from the date picker's calendar view, which the DateTimePicker also shows. The product's words are read from the `\\.tanreiWords` environment value."},"compose":{"status":"planned","name":"TanreiCalendar","props":{"mode":"mode","value":"value","start":"start","end":"end","min":"min","max":"max","disabledDates":"disabledDates","today":"today","firstDayOfWeek":"firstDayOfWeek","locale":"locale","startView":"startView","showAdjacentDays":"showAdjacentDays","label":"label","startLabel":"startLabel","endLabel":"endLabel","previousMonthLabel":"previousMonthLabel","nextMonthLabel":"nextMonthLabel","yearViewLabel":"yearViewLabel","todayLabel":"todayLabel"},"events":{"change":"onChange"},"items":{"day":{"name":"TanreiCalendarDay","props":{"date":"date","disabled":"disabled","adjacent":"adjacent"}},"year":{"name":"TanreiCalendarYear","props":{"year":"year"}}},"notes":"Planned. `TanreiCalendar(mode, value, start, end, onChange, min, max, disabledDates, isDateDisabled, today, firstDayOfWeek, locale, startView, showAdjacentDays, label, labels, modifier)`. Dates are `TanreiDate(year, month, day)`, the date picker's value class (API 23 has no `java.time.LocalDate`). `onChange` receives a `TanreiDateSelection(value, start, end)`; the caller keeps the state (hoisting). The other words are fields of a `TanreiCalendarLabels`. Compose has no grid role: the grid sets `collectionInfo` (7 columns) and each day `collectionItemInfo`, `Role.Button`, `selected` and `disabled()`. The drag of CAL-30 through `pointerInput` on the axis with a `VelocityTracker` for the fling, for touch, a stylus and a mouse alike; a scroll (CAL-33) through `PointerEventType.Scroll`, a mouse wheel's being steps. On the horizontal axis a `HorizontalPager` with one page a month is the likely primitive; on the vertical axis the weeks are one column offset by a progress with `lerp` for the colors (CAL-29), which a pager cannot draw, since it lays out two pages. Arrow keys through `onPreviewKeyEvent`. The navigation buttons are `TanreiButton`s with an icon and no label. The product's words are read from `LocalTanreiWords`."},"flutter":{"status":"planned","name":"TanreiCalendar","props":{"mode":"mode","value":"value","start":"start","end":"end","min":"firstDate","max":"lastDate","disabledDates":"disabledDates","today":"currentDate","firstDayOfWeek":"firstDayOfWeek","locale":"locale","startView":"startView","showAdjacentDays":"showAdjacentDays","label":"label","startLabel":"startLabel","endLabel":"endLabel","previousMonthLabel":"previousMonthLabel","nextMonthLabel":"nextMonthLabel","yearViewLabel":"yearViewLabel","todayLabel":"todayLabel"},"events":{"change":"onChanged"},"items":{"day":{"name":"TanreiCalendarDay","props":{"date":"date","disabled":"disabled","adjacent":"adjacent"}},"year":{"name":"TanreiCalendarYear","props":{"year":"year"}}},"notes":"Planned. A widget, as Flutter's own `CalendarDatePicker` is an inline calendar: `TanreiCalendar(mode:, value:, start:, end:, onChanged:, firstDate:, lastDate:, currentDate:, …)`; `firstDate`, `lastDate` and `currentDate` keep Flutter's names. Dates are `DateTime`s of which only the year, month and day are read; `isDateDisabled` is a function. `onChanged` receives a `TanreiDateSelection`. Month and weekday names come from `TanreiDateLocalizations` (English built in, no `intl` dependency), the first day of the week from the embedded CLDR table. On the horizontal axis paging through a `PageView`; on the vertical axis the weeks are one column driven by an `AnimationController` whose value is the progress of CAL-29 (`Color.lerp` for the colors), moved by a `GestureDetector`'s vertical drag callbacks, with `DragEndDetails.primaryVelocity` for the fling, for every `PointerDeviceKind`; a trackpad's scroll (CAL-33) arrives as `PointerPanZoomUpdateEvent`s, whose end event ends it (CAL-34), and a mouse wheel's `PointerScrollEvent` is a step. The navigation buttons are `TanreiButton`s with an icon and no label. The product's words are read from the `TanreiWords` inherited widget, which the app fills from its own localizations."},"react-native":{"status":"planned","name":"Calendar","props":{"mode":"mode","value":"value","start":"start","end":"end","min":"min","max":"max","disabledDates":"disabledDates","today":"today","firstDayOfWeek":"firstDayOfWeek","locale":"locale","startView":"startView","showAdjacentDays":"showAdjacentDays","label":"accessibilityLabel","startLabel":"startLabel","endLabel":"endLabel","previousMonthLabel":"previousMonthLabel","nextMonthLabel":"nextMonthLabel","yearViewLabel":"yearViewLabel","todayLabel":"todayLabel"},"events":{"change":"onChange"},"items":{"day":{"name":"CalendarDay","props":{"date":"date","disabled":"disabled","adjacent":"adjacent"}},"year":{"name":"CalendarYear","props":{"year":"year"}}},"notes":"Planned. Controlled: `value` (or `start` and `end`) and `onChange({ value, start, end })`; the caller moves them. Dates are ISO 8601 strings, never `Date` objects, so no time zone enters. `isDateDisabled` is a function prop. The grid has the `grid` role; days the `button` role with `accessibilityState` `selected` and `disabled`. The drag of CAL-30 through a `PanResponder` on the axis (the release's velocity gives the fling) and, on the web renderer, `onWheel` read as the web package reads it (CAL-33, CAL-34); on the vertical axis the weeks are one column moved by an `Animated.Value` that is the progress of CAL-29, with `interpolate` for the colors and the opacity. Locale data from Hermes's `Intl.DateTimeFormat`; the first day of the week from the embedded CLDR table. The navigation buttons are the package's `Button` with an icon and no label. The product's words are read from the `TanreiWordsProvider` context."}}}