@tempoxyz/ds 0.3.14 → 0.3.16

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 (209) hide show
  1. package/dist/docs/AGENTS.md +75 -10
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +32 -24
  4. package/dist/docs/product/components/actions.md +2110 -0
  5. package/dist/docs/product/components/blockchain.md +3969 -0
  6. package/dist/docs/product/components/data-display.md +5901 -0
  7. package/dist/docs/product/components/feedback-and-status.md +4138 -0
  8. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  9. package/dist/docs/product/components/layout.md +3339 -0
  10. package/dist/docs/product/components/navigation.md +2914 -0
  11. package/dist/docs/product/components/overlays.md +4917 -0
  12. package/dist/docs/product/components.md +125 -125
  13. package/dist/docs/product/foundations.md +4597 -0
  14. package/dist/docs/product/patterns.md +10110 -0
  15. package/dist/marketing/index.js.zyzz.json +1 -1
  16. package/dist/marketing/vars.d.ts +618 -758
  17. package/dist/marketing/vars.d.ts.map +1 -1
  18. package/dist/marketing/vars.js +8 -5
  19. package/dist/marketing/vars.js.map +1 -1
  20. package/dist/marketing/vars.js.zyzz.json +1 -1
  21. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  22. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  23. package/dist/marketing/zyzz.config.js +1 -1
  24. package/dist/marketing/zyzz.config.js.map +1 -1
  25. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  26. package/dist/mobile/components/Button.d.ts +115 -15
  27. package/dist/mobile/components/Button.d.ts.map +1 -1
  28. package/dist/mobile/components/Button.js +85 -14
  29. package/dist/mobile/components/Button.js.map +1 -1
  30. package/dist/mobile/components/IconButton.d.ts +129 -40
  31. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  32. package/dist/mobile/components/IconButton.js +97 -28
  33. package/dist/mobile/components/IconButton.js.map +1 -1
  34. package/dist/mobile/components/TextInput.d.ts +132 -11
  35. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  36. package/dist/mobile/components/TextInput.js +115 -14
  37. package/dist/mobile/components/TextInput.js.map +1 -1
  38. package/dist/mobile/index.d.ts +1 -0
  39. package/dist/mobile/index.d.ts.map +1 -1
  40. package/dist/mobile/index.js +1 -0
  41. package/dist/mobile/index.js.map +1 -1
  42. package/dist/mobile/vars.d.ts +103 -0
  43. package/dist/mobile/vars.d.ts.map +1 -1
  44. package/dist/mobile/vars.js +74 -0
  45. package/dist/mobile/vars.js.map +1 -1
  46. package/dist/mobile/zyzz.config.d.ts +408 -0
  47. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  48. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  49. package/dist/web/components/Amount.css +1 -1
  50. package/dist/web/components/Amount.d.ts +9 -0
  51. package/dist/web/components/Amount.d.ts.map +1 -1
  52. package/dist/web/components/Amount.js +8 -5
  53. package/dist/web/components/Amount.js.map +1 -1
  54. package/dist/web/components/Amount.js.zyzz.json +1 -1
  55. package/dist/web/components/CopyButton.d.ts +6 -0
  56. package/dist/web/components/CopyButton.d.ts.map +1 -1
  57. package/dist/web/components/CopyButton.js +4 -1
  58. package/dist/web/components/CopyButton.js.map +1 -1
  59. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  60. package/dist/web/components/Hex.css +1 -1
  61. package/dist/web/components/Hex.d.ts +84 -3
  62. package/dist/web/components/Hex.d.ts.map +1 -1
  63. package/dist/web/components/Hex.js +20 -13
  64. package/dist/web/components/Hex.js.map +1 -1
  65. package/dist/web/components/Hex.js.zyzz.json +1 -1
  66. package/dist/web/components/Progress.css +1 -1
  67. package/dist/web/components/Progress.d.ts +12 -2
  68. package/dist/web/components/Progress.d.ts.map +1 -1
  69. package/dist/web/components/Progress.js +9 -5
  70. package/dist/web/components/Progress.js.map +1 -1
  71. package/dist/web/components/Progress.js.zyzz.json +1 -1
  72. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  73. package/dist/web/components/SidebarMenu.d.ts +4 -4
  74. package/dist/web/components/SidebarMenu.js +6 -6
  75. package/dist/web/components/SidebarMenu.js.map +1 -1
  76. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  77. package/dist/web/index.js.zyzz.json +1 -1
  78. package/package.json +1 -1
  79. package/src/marketing/README.md +1 -1
  80. package/src/marketing/vars.ts +526 -604
  81. package/src/marketing/zyzz.config.ts +5 -4
  82. package/src/mobile/README.md +19 -6
  83. package/src/mobile/components/Button.tsx +94 -17
  84. package/src/mobile/components/IconButton.tsx +122 -30
  85. package/src/mobile/components/TextInput.tsx +139 -24
  86. package/src/mobile/index.ts +1 -0
  87. package/src/mobile/vars.ts +74 -0
  88. package/src/web/components/Amount.tsx +37 -3
  89. package/src/web/components/CopyButton.tsx +8 -0
  90. package/src/web/components/Hex.tsx +79 -13
  91. package/src/web/components/Progress.tsx +8 -2
  92. package/src/web/components/SidebarMenu.tsx +6 -6
  93. package/dist/docs/index.md +0 -145
  94. package/dist/docs/product/components/accordion.md +0 -489
  95. package/dist/docs/product/components/address-card.md +0 -147
  96. package/dist/docs/product/components/agent-logo.md +0 -194
  97. package/dist/docs/product/components/alert-dialog.md +0 -631
  98. package/dist/docs/product/components/alert.md +0 -448
  99. package/dist/docs/product/components/amount-input.md +0 -305
  100. package/dist/docs/product/components/amount.md +0 -794
  101. package/dist/docs/product/components/app-shell.md +0 -559
  102. package/dist/docs/product/components/asset-chip.md +0 -294
  103. package/dist/docs/product/components/autocomplete.md +0 -620
  104. package/dist/docs/product/components/avatar.md +0 -321
  105. package/dist/docs/product/components/badge.md +0 -339
  106. package/dist/docs/product/components/badged-logo.md +0 -116
  107. package/dist/docs/product/components/banner.md +0 -379
  108. package/dist/docs/product/components/bar-chart.md +0 -208
  109. package/dist/docs/product/components/breadcrumbs.md +0 -380
  110. package/dist/docs/product/components/button-group.md +0 -286
  111. package/dist/docs/product/components/button.md +0 -650
  112. package/dist/docs/product/components/calendar.md +0 -375
  113. package/dist/docs/product/components/callout.md +0 -96
  114. package/dist/docs/product/components/checkbox-group.md +0 -521
  115. package/dist/docs/product/components/checkbox.md +0 -467
  116. package/dist/docs/product/components/choice-group.md +0 -516
  117. package/dist/docs/product/components/choicebox.md +0 -641
  118. package/dist/docs/product/components/code.md +0 -100
  119. package/dist/docs/product/components/combobox.md +0 -939
  120. package/dist/docs/product/components/container.md +0 -257
  121. package/dist/docs/product/components/copy-button.md +0 -642
  122. package/dist/docs/product/components/date-picker.md +0 -514
  123. package/dist/docs/product/components/dialog.md +0 -1332
  124. package/dist/docs/product/components/drawer.md +0 -966
  125. package/dist/docs/product/components/empty.md +0 -340
  126. package/dist/docs/product/components/field.md +0 -570
  127. package/dist/docs/product/components/fieldset.md +0 -398
  128. package/dist/docs/product/components/frame.md +0 -434
  129. package/dist/docs/product/components/gauge.md +0 -299
  130. package/dist/docs/product/components/get-started-visual.md +0 -117
  131. package/dist/docs/product/components/grid.md +0 -288
  132. package/dist/docs/product/components/hero-visual.md +0 -155
  133. package/dist/docs/product/components/hex.md +0 -487
  134. package/dist/docs/product/components/icon-tile.md +0 -292
  135. package/dist/docs/product/components/identicon.md +0 -371
  136. package/dist/docs/product/components/inline.md +0 -233
  137. package/dist/docs/product/components/inset.md +0 -225
  138. package/dist/docs/product/components/kbd.md +0 -423
  139. package/dist/docs/product/components/list-group.md +0 -981
  140. package/dist/docs/product/components/loading-dots.md +0 -237
  141. package/dist/docs/product/components/menu.md +0 -934
  142. package/dist/docs/product/components/native-select.md +0 -204
  143. package/dist/docs/product/components/network-logo.md +0 -248
  144. package/dist/docs/product/components/number-field.md +0 -543
  145. package/dist/docs/product/components/otp-field.md +0 -616
  146. package/dist/docs/product/components/pagination.md +0 -516
  147. package/dist/docs/product/components/popover.md +0 -544
  148. package/dist/docs/product/components/progress.md +0 -388
  149. package/dist/docs/product/components/qr.md +0 -314
  150. package/dist/docs/product/components/radio-group.md +0 -528
  151. package/dist/docs/product/components/secret-value.md +0 -406
  152. package/dist/docs/product/components/select.md +0 -751
  153. package/dist/docs/product/components/separator.md +0 -379
  154. package/dist/docs/product/components/sidebar-menu.md +0 -922
  155. package/dist/docs/product/components/skeleton.md +0 -517
  156. package/dist/docs/product/components/slider.md +0 -539
  157. package/dist/docs/product/components/snippet.md +0 -424
  158. package/dist/docs/product/components/spinner.md +0 -216
  159. package/dist/docs/product/components/split-bar.md +0 -139
  160. package/dist/docs/product/components/split-button.md +0 -464
  161. package/dist/docs/product/components/stack.md +0 -299
  162. package/dist/docs/product/components/status-chip.md +0 -226
  163. package/dist/docs/product/components/status-indicator.md +0 -119
  164. package/dist/docs/product/components/status-row.md +0 -174
  165. package/dist/docs/product/components/stepper.md +0 -451
  166. package/dist/docs/product/components/success-hero.md +0 -157
  167. package/dist/docs/product/components/surface.md +0 -639
  168. package/dist/docs/product/components/switch.md +0 -472
  169. package/dist/docs/product/components/table.md +0 -968
  170. package/dist/docs/product/components/tabs.md +0 -627
  171. package/dist/docs/product/components/tempo-logo.md +0 -185
  172. package/dist/docs/product/components/text-input.md +0 -624
  173. package/dist/docs/product/components/textarea.md +0 -352
  174. package/dist/docs/product/components/toast.md +0 -535
  175. package/dist/docs/product/components/token-logo.md +0 -371
  176. package/dist/docs/product/components/token.md +0 -247
  177. package/dist/docs/product/components/tooltip.md +0 -490
  178. package/dist/docs/product/components/verification-code.md +0 -116
  179. package/dist/docs/product/components/visual.md +0 -249
  180. package/dist/docs/product/foundations/accessibility.md +0 -377
  181. package/dist/docs/product/foundations/agents.md +0 -159
  182. package/dist/docs/product/foundations/color.md +0 -522
  183. package/dist/docs/product/foundations/content/tone.md +0 -194
  184. package/dist/docs/product/foundations/content/voice.md +0 -194
  185. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  186. package/dist/docs/product/foundations/iconography.md +0 -282
  187. package/dist/docs/product/foundations/intent.md +0 -360
  188. package/dist/docs/product/foundations/layout.md +0 -508
  189. package/dist/docs/product/foundations/linter.md +0 -523
  190. package/dist/docs/product/foundations/motion.md +0 -151
  191. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  192. package/dist/docs/product/foundations/typography.md +0 -331
  193. package/dist/docs/product/introduction/faq.md +0 -133
  194. package/dist/docs/product/introduction/getting-started.md +0 -377
  195. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  196. package/dist/docs/product/patterns/dashboards.md +0 -638
  197. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  198. package/dist/docs/product/patterns/empty-states.md +0 -612
  199. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  200. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  201. package/dist/docs/product/patterns/forms.md +0 -679
  202. package/dist/docs/product/patterns/loading.md +0 -630
  203. package/dist/docs/product/patterns/navigation.md +0 -397
  204. package/dist/docs/product/patterns/payments.md +0 -765
  205. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  206. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  207. package/dist/docs/product/products/tempo-console.md +0 -671
  208. package/dist/docs/product/products/tempo-performance.md +0 -435
  209. package/dist/docs/product/products/tempo-wallet.md +0 -438
@@ -1,139 +0,0 @@
1
- # SplitBar
2
-
3
- Splits one total between two parts, with a legend under the bar.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/SplitBar.tsx)
6
-
7
- Figma: [Data/Split Bar](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-4474)
8
-
9
- ## Overview
10
-
11
- A split bar renders a thin bar that two parts share in proportion to their values, and a legend that names each part with its value. A part of zero draws no segment, so the other part fills the bar.
12
-
13
- ## Examples
14
-
15
- ### Basic
16
-
17
- ```tsx
18
- import { SplitBar } from '@tempoxyz/ds'
19
-
20
- export function Demo() {
21
- return (
22
- <SplitBar
23
- items={[
24
- { label: 'Available', text: '$75.62', value: 75.62 },
25
- { label: 'Agents', text: '$8.58', value: 8.58 },
26
- ]}
27
- />
28
- )
29
- }
30
- ```
31
-
32
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SplitBar/Basic.tsx)
33
-
34
- ### One Part
35
-
36
- A part of 0 keeps its legend entry and draws no segment.
37
-
38
- ```tsx
39
- import { SplitBar } from '@tempoxyz/ds'
40
-
41
- export function Demo() {
42
- return (
43
- <SplitBar
44
- items={[
45
- { label: 'Available', text: '$75.62', value: 75.62 },
46
- { label: 'Agents', text: '$0.00', value: 0 },
47
- ]}
48
- />
49
- )
50
- }
51
- ```
52
-
53
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SplitBar/Empty.tsx)
54
-
55
- ## Anatomy
56
-
57
- Import the component and assemble its parts.
58
-
59
- ```tsx
60
- import { SplitBar } from '@tempoxyz/ds'
61
-
62
- <SplitBar />
63
- ```
64
-
65
- ## Guidelines
66
-
67
- ### When to Use
68
-
69
- * Show how a balance splits between two uses, such as the available funds and the funds set aside for agents.
70
-
71
- ### When Not to Use
72
-
73
- * Use [BarChart](bar-chart.md) for values over time.
74
- * Use [Progress](progress.md) for the progress of one task.
75
- * Use [Gauge](gauge.md) for one value against a limit.
76
-
77
- ### Show the Values
78
-
79
- **Do:** Give each part its amount, in the unit people act on.
80
-
81
- ```tsx
82
- import { SplitBar } from '@tempoxyz/ds'
83
-
84
- export function Demo() {
85
- return (
86
- <SplitBar
87
- items={[
88
- { label: 'Available', text: '$75.62', value: 75.62 },
89
- { label: 'Agents', text: '$8.58', value: 8.58 },
90
- ]}
91
- />
92
- )
93
- }
94
- ```
95
-
96
- **Don't:** Show percentages alone when people act on amounts.
97
-
98
- ```tsx
99
- import { SplitBar } from '@tempoxyz/ds'
100
-
101
- export function Demo() {
102
- return (
103
- <SplitBar
104
- items={[
105
- { label: 'Available', text: '90%', value: 90 },
106
- { label: 'Agents', text: '10%', value: 10 },
107
- ]}
108
- />
109
- )
110
- }
111
- ```
112
-
113
- ## Content
114
-
115
- ### Name the Parts
116
-
117
- Name each part with one or two words, such as Available and Agents. Format each value as the rest of the page does, such as $75.62.
118
-
119
- ## Accessibility
120
-
121
- A split bar renders a `<div>` whose bar is hidden from screen readers. The legend carries each label and value as text, in reading order.
122
-
123
- ### Semantics
124
-
125
- * **Bar (aria-hidden):** Screen readers skip the bar and read the legend.
126
-
127
- ### Your Responsibilities
128
-
129
- * **Name the Total (SC 1.3.1):** Place a heading or a label before the bar that names what it splits.
130
-
131
- ## Related
132
-
133
- [BarChart](bar-chart.md)
134
-
135
- Use for values over time.
136
-
137
- [Progress](progress.md)
138
-
139
- Use for the progress of one task.
@@ -1,464 +0,0 @@
1
- # SplitButton
2
-
3
- Pairs a primary action with a menu of alternatives.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/SplitButton.tsx)
6
-
7
- ## Overview
8
-
9
- A split button places the most common action beside a trigger that opens a menu of alternatives.
10
-
11
- ## Examples
12
-
13
- ### Basic
14
-
15
- ```tsx
16
- import { Menu, SplitButton } from '@tempoxyz/ds'
17
-
18
- export function Demo() {
19
- return (
20
- <SplitButton.Root aria-label="Save">
21
- <SplitButton.Action>Save</SplitButton.Action>
22
- <Menu.Root>
23
- <SplitButton.Trigger aria-label="More save options" />
24
- <Menu.Popup align="end">
25
- <Menu.Item>Save as draft</Menu.Item>
26
- <Menu.Item>Save and close</Menu.Item>
27
- </Menu.Popup>
28
- </Menu.Root>
29
- </SplitButton.Root>
30
- )
31
- }
32
- ```
33
-
34
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SplitButton/Basic.tsx)
35
-
36
- ### Variant
37
-
38
- Set `variant` on `SplitButton.Root` to `primary` (default), `secondary`, or `tertiary`.
39
-
40
- ```tsx
41
- import { Menu, SplitButton, style } from '@tempoxyz/ds'
42
-
43
- export function Demo() {
44
- return (
45
- <div {...styles.row()}>
46
- {(['primary', 'secondary', 'tertiary'] as const).map((variant) => (
47
- <SplitButton.Root key={variant} variant={variant}>
48
- <SplitButton.Action>Save</SplitButton.Action>
49
- <Menu.Root>
50
- <SplitButton.Trigger aria-label="More save options" />
51
- <Menu.Popup align="end">
52
- <Menu.Item>Save as draft</Menu.Item>
53
- <Menu.Item>Save and close</Menu.Item>
54
- </Menu.Popup>
55
- </Menu.Root>
56
- </SplitButton.Root>
57
- ))}
58
- </div>
59
- )
60
- }
61
-
62
- namespace styles {
63
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '12' })
64
- }
65
- ```
66
-
67
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SplitButton/Variant.tsx)
68
-
69
- ## Anatomy
70
-
71
- Import the component and assemble its parts.
72
-
73
- ```tsx
74
- import { Menu, SplitButton } from '@tempoxyz/ds'
75
-
76
- <SplitButton.Root>
77
- <SplitButton.Action />
78
- <Menu.Root>
79
- <SplitButton.Trigger />
80
- <Menu.Popup />
81
- </Menu.Root>
82
- </SplitButton.Root>
83
- ```
84
-
85
- ## Guidelines
86
-
87
- ### When to Use
88
-
89
- * Offer a main action with a few variations, such as Export CSV with Export JSON and Schedule export.
90
- * Keep the common choice one press away, such as Create key with Create test key.
91
-
92
- ### When Not to Use
93
-
94
- * Use a [Button](button.md) with a [Menu](menu.md) when no option is the clear default.
95
- * Use two [Buttons](button.md) when both actions matter equally.
96
- * Use [Select](select.md) or [ChoiceGroup](choice-group.md) to choose a value or mode, not to run an action.
97
- * Use a separate [Button](button.md) for destructive actions, confirmed with an [AlertDialog](alert-dialog.md).
98
-
99
- ### Make the Action the Common Choice
100
-
101
- `SplitButton.Action` runs without opening the menu, so give it the option most people pick. If people often open the menu first, move the popular option into the action, or use a [Menu](menu.md) button.
102
-
103
- **Do:** Put the option most people pick on the action.
104
-
105
- ```tsx
106
- /**
107
- * Do example for "Make the Action the Common Choice" on the SplitButton page.
108
- * Put the option most people pick on the action.
109
- * @module
110
- */
111
- import { Menu, SplitButton, style } from '@tempoxyz/ds'
112
-
113
- /** Renders the static preview, which the guideline card shows inert. */
114
- export function Demo() {
115
- return (
116
- <div {...styles.stack()}>
117
- <SplitButton.Root aria-label="Keys">
118
- <SplitButton.Action>Create key</SplitButton.Action>
119
- <Menu.Root>
120
- <SplitButton.Trigger aria-label="More key options" />
121
- </Menu.Root>
122
- </SplitButton.Root>
123
- <div {...styles.popup()}>
124
- <div {...styles.item()}>Create test key</div>
125
- <div {...styles.item()}>Import key</div>
126
- </div>
127
- </div>
128
- )
129
- }
130
-
131
- namespace styles {
132
- export const item = style({
133
- alignItems: 'center',
134
- borderRadius: 'xs',
135
- color: 'content.primary',
136
- display: 'flex',
137
- minHeight: '40',
138
- paddingInline: '12',
139
- typography: 'body.b2Strong',
140
- })
141
-
142
- export const popup = style({
143
- backgroundColor: 'background.elevated',
144
- borderRadius: 'sm',
145
- boxShadow: 'regular',
146
- boxSizing: 'border-box',
147
- minWidth: '14rem !custom',
148
- padding: '12',
149
- })
150
-
151
- export const stack = style({
152
- alignItems: 'flex-end',
153
- display: 'flex',
154
- flexDirection: 'column',
155
- rowGap: '4',
156
- })
157
- }
158
- ```
159
-
160
- **Don't:** Put a rare option on the action and the common one in the menu.
161
-
162
- ```tsx
163
- /**
164
- * Don't example for "Make the Action the Common Choice" on the SplitButton page.
165
- * Don't put a rare option on the action and the common one in the menu.
166
- * @module
167
- */
168
- import { Menu, SplitButton, style } from '@tempoxyz/ds'
169
-
170
- /** Renders the static preview, which the guideline card shows inert. */
171
- export function Demo() {
172
- return (
173
- <div {...styles.stack()}>
174
- <SplitButton.Root aria-label="Keys">
175
- <SplitButton.Action>Import key</SplitButton.Action>
176
- <Menu.Root>
177
- <SplitButton.Trigger aria-label="More key options" />
178
- </Menu.Root>
179
- </SplitButton.Root>
180
- <div {...styles.popup()}>
181
- <div {...styles.item()}>Create key</div>
182
- <div {...styles.item()}>Create test key</div>
183
- </div>
184
- </div>
185
- )
186
- }
187
-
188
- namespace styles {
189
- export const item = style({
190
- alignItems: 'center',
191
- borderRadius: 'xs',
192
- color: 'content.primary',
193
- display: 'flex',
194
- minHeight: '40',
195
- paddingInline: '12',
196
- typography: 'body.b2Strong',
197
- })
198
-
199
- export const popup = style({
200
- backgroundColor: 'background.elevated',
201
- borderRadius: 'sm',
202
- boxShadow: 'regular',
203
- boxSizing: 'border-box',
204
- minWidth: '14rem !custom',
205
- padding: '12',
206
- })
207
-
208
- export const stack = style({
209
- alignItems: 'flex-end',
210
- display: 'flex',
211
- flexDirection: 'column',
212
- rowGap: '4',
213
- })
214
- }
215
- ```
216
-
217
- ### Keep Alternatives Related
218
-
219
- Make every menu item a variation of the action, such as a different format or timing, and use two to five of them. Put unrelated commands, or a longer list, in a [Menu](menu.md).
220
-
221
- **Do:** Fill the menu with variations of the main action.
222
-
223
- ```tsx
224
- /**
225
- * Do example for "Keep Alternatives Related" on the SplitButton page.
226
- * Fill the menu with variations of the main action.
227
- * @module
228
- */
229
- import { Menu, SplitButton, style } from '@tempoxyz/ds'
230
-
231
- /** Renders the static preview, which the guideline card shows inert. */
232
- export function Demo() {
233
- return (
234
- <div {...styles.stack()}>
235
- <SplitButton.Root aria-label="Export" variant="secondary">
236
- <SplitButton.Action>Export CSV</SplitButton.Action>
237
- <Menu.Root>
238
- <SplitButton.Trigger aria-label="More export options" />
239
- </Menu.Root>
240
- </SplitButton.Root>
241
- <div {...styles.popup()}>
242
- <div {...styles.item()}>Export JSON</div>
243
- <div {...styles.item()}>Schedule export</div>
244
- </div>
245
- </div>
246
- )
247
- }
248
-
249
- namespace styles {
250
- export const item = style({
251
- alignItems: 'center',
252
- borderRadius: 'xs',
253
- color: 'content.primary',
254
- display: 'flex',
255
- minHeight: '40',
256
- paddingInline: '12',
257
- typography: 'body.b2Strong',
258
- })
259
-
260
- export const popup = style({
261
- backgroundColor: 'background.elevated',
262
- borderRadius: 'sm',
263
- boxShadow: 'regular',
264
- boxSizing: 'border-box',
265
- minWidth: '14rem !custom',
266
- padding: '12',
267
- })
268
-
269
- export const stack = style({
270
- alignItems: 'flex-end',
271
- display: 'flex',
272
- flexDirection: 'column',
273
- rowGap: '4',
274
- })
275
- }
276
- ```
277
-
278
- **Don't:** Collect unrelated or destructive commands behind the trigger.
279
-
280
- ```tsx
281
- /**
282
- * Don't example for "Keep Alternatives Related" on the SplitButton page.
283
- * Don't collect unrelated or destructive commands behind the trigger.
284
- * @module
285
- */
286
- import { Menu, SplitButton, style, variants } from '@tempoxyz/ds'
287
-
288
- /** Renders the static preview, which the guideline card shows inert. */
289
- export function Demo() {
290
- return (
291
- <div {...styles.stack()}>
292
- <SplitButton.Root aria-label="Export" variant="secondary">
293
- <SplitButton.Action>Export CSV</SplitButton.Action>
294
- <Menu.Root>
295
- <SplitButton.Trigger aria-label="More options" />
296
- </Menu.Root>
297
- </SplitButton.Root>
298
- <div {...styles.popup()}>
299
- <div {...styles.item()}>Rename dashboard</div>
300
- <div {...styles.item()}>Share</div>
301
- <div {...styles.item({ intent: 'negative' })}>Delete dashboard</div>
302
- </div>
303
- </div>
304
- )
305
- }
306
-
307
- namespace styles {
308
- export const item = variants({
309
- base: {
310
- alignItems: 'center',
311
- borderRadius: 'xs',
312
- color: 'content.primary',
313
- display: 'flex',
314
- minHeight: '40',
315
- paddingInline: '12',
316
- typography: 'body.b2Strong',
317
- },
318
- defaultVariants: { intent: 'default' },
319
- variants: {
320
- intent: {
321
- default: {},
322
- negative: { color: 'content.negative' },
323
- },
324
- },
325
- })
326
-
327
- export const popup = style({
328
- backgroundColor: 'background.elevated',
329
- borderRadius: 'sm',
330
- boxShadow: 'regular',
331
- boxSizing: 'border-box',
332
- minWidth: '14rem !custom',
333
- padding: '12',
334
- })
335
-
336
- export const stack = style({
337
- alignItems: 'flex-end',
338
- display: 'flex',
339
- flexDirection: 'column',
340
- rowGap: '4',
341
- })
342
- }
343
- ```
344
-
345
- ### Match the Buttons Around It
346
-
347
- Set `variant` and `size` on `SplitButton.Root`, and both buttons follow. A split button counts toward the one `primary` action per section, so use `secondary` when the view already has one. Use `small` in toolbars and table headers.
348
-
349
- **Do:** Match the size of nearby buttons, and leave `primary` to the main action.
350
-
351
- ```tsx
352
- /**
353
- * Do example for "Match the Buttons Around It" on the SplitButton page.
354
- * Match the size of nearby buttons, and leave `primary` to the main action.
355
- * @module
356
- */
357
- import { Button, Menu, SplitButton, style } from '@tempoxyz/ds'
358
-
359
- /** Renders the static preview, which the guideline card shows inert. */
360
- export function Demo() {
361
- return (
362
- <div {...styles.row()}>
363
- <SplitButton.Root aria-label="Export" size="small" variant="secondary">
364
- <SplitButton.Action>Export CSV</SplitButton.Action>
365
- <Menu.Root>
366
- <SplitButton.Trigger aria-label="More export options" />
367
- </Menu.Root>
368
- </SplitButton.Root>
369
- <Button size="small">Send payment</Button>
370
- </div>
371
- )
372
- }
373
-
374
- namespace styles {
375
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '8' })
376
- }
377
- ```
378
-
379
- **Don't:** Add a second `primary` action, or a size that differs from its neighbors.
380
-
381
- ```tsx
382
- /**
383
- * Don't example for "Match the Buttons Around It" on the SplitButton page.
384
- * Don't add a second `primary` action, or a size that differs from its neighbors.
385
- * @module
386
- */
387
- import { Button, Menu, SplitButton, style } from '@tempoxyz/ds'
388
-
389
- /** Renders the static preview, which the guideline card shows inert. */
390
- export function Demo() {
391
- return (
392
- <div {...styles.row()}>
393
- <SplitButton.Root aria-label="Export">
394
- <SplitButton.Action>Export CSV</SplitButton.Action>
395
- <Menu.Root>
396
- <SplitButton.Trigger aria-label="More export options" />
397
- </Menu.Root>
398
- </SplitButton.Root>
399
- <Button size="small">Send payment</Button>
400
- </div>
401
- )
402
- }
403
-
404
- namespace styles {
405
- export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '8' })
406
- }
407
- ```
408
-
409
- ## Content
410
-
411
- ### Name the Action and Its Object
412
-
413
- Label `SplitButton.Action` with a verb and an object, such as Export CSV. A bare Export hides which variation runs.
414
-
415
- ### Make Each Item Stand Alone
416
-
417
- Repeat the verb in each menu item, such as Export JSON, not JSON, so each item reads as a complete action.
418
-
419
- ## Accessibility
420
-
421
- `SplitButton` renders a group with a primary [Button](button.md) and a menu trigger. The trigger follows the [WAI-ARIA menu button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/).
422
-
423
- ### Semantics
424
-
425
- * **SplitButton.Root (group):** Holds both buttons, named by its `aria-label`.
426
- * **SplitButton.Action (button):** The primary action, as a native button.
427
- * **SplitButton.Trigger (aria-haspopup):** A native button that announces its menu and open state.
428
- * **Menu (menu):** Named by the trigger. Items are announced as menu items.
429
- * **Chevron (reduced motion):** Rotates while the menu is open. Flips without animation under reduced motion.
430
-
431
- ### Keyboard
432
-
433
- * **Move Between Buttons (Tab):** Moves focus to the action, then to the trigger.
434
- * **Run the Action (Enter or Space):** On the action, runs the primary action.
435
- * **Open to the First Item (Enter, Space, or Down Arrow):** Opens the menu and focuses the first item.
436
- * **Open to the Last Item (Up Arrow):** Opens the menu and focuses the last item.
437
- * **Move Between Items (Down Arrow and Up Arrow):** Move between items, and wrap at the ends.
438
- * **Jump to the Ends (Home and End):** Move to the first and last item.
439
- * **Activate an Item (Enter):** Activates the focused item and closes the menu.
440
- * **Close the Menu (Escape):** Closes the menu.
441
-
442
- ### Your Responsibilities
443
-
444
- * **Name the Group (aria-label):** Name the root, such as "Save", so the pair reads as one group.
445
- * **Name the Trigger (aria-label):** Name the alternatives, such as "More save options". The chevron is the trigger's only content.
446
- * **Keep Actions Reachable:** If the primary action fails or is disabled, keep every menu action reachable another way.
447
-
448
- ## Related
449
-
450
- [Button](button.md)
451
-
452
- Use for single actions.
453
-
454
- [Menu](menu.md)
455
-
456
- Use for lists of actions without a default.
457
-
458
- [AlertDialog](alert-dialog.md)
459
-
460
- Use for confirming destructive actions.
461
-
462
- [Forms](../patterns/forms.md)
463
-
464
- Covers placing actions.