@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
@@ -0,0 +1,3969 @@
1
+ # Blockchain
2
+
3
+ Each component section states its guidance first, then its Examples and Use Cases. Read a section up to its Examples heading before you use the component, then read the examples it needs.
4
+
5
+ ## Contents
6
+
7
+ Components for onchain values such as addresses, amounts, and tokens.
8
+
9
+ - [AddressCard](#addresscard): Shows a wallet address to receive funds, with its QR code and networks.
10
+ - [Amount](#amount): Formats a number as money or a token amount.
11
+ - [AssetChip](#assetchip): Labels a supported asset or network in a small chip, which can also pick one.
12
+ - [BadgedLogo](#badgedlogo): Marks a token or an app with a small badge on the corner of its logo.
13
+ - [Hex](#hex): Shows a hex string, such as an address, truncated to fit.
14
+ - [Identicon](#identicon): Shows a unique gradient avatar derived from an address.
15
+ - [NetworkLogo](#networklogo): Shows the logo of the network a token lives on.
16
+ - [Qr](#qr): Renders a value as a QR code.
17
+ - [SecretValue](#secretvalue): Masks a secret and adds reveal and copy buttons.
18
+ - [Token](#token-1): Shows which token an amount is in, and opens a picker to change it.
19
+ - [TokenLogo](#tokenlogo): Shows a token logo by contract address or symbol.
20
+
21
+ ## AddressCard
22
+
23
+ Shows a wallet address to receive funds, with its QR code and networks.
24
+
25
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AddressCard.tsx)
26
+
27
+ Figma: [Content/Address Card](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-4005)
28
+
29
+ ### Overview
30
+
31
+ An address card renders a bordered receive card. A QR code of the address sits beside the shortened address, a copy button, and the networks that the address accepts.
32
+
33
+ ### Anatomy
34
+
35
+ Import the component and assemble its parts.
36
+
37
+ ```tsx
38
+ import { AddressCard } from '@tempoxyz/ds'
39
+
40
+ <AddressCard>
41
+ <AddressCard.Networks>
42
+ <AddressCard.Network />
43
+ </AddressCard.Networks>
44
+ </AddressCard>
45
+ ```
46
+
47
+ ### Guidelines
48
+
49
+ #### When to Use
50
+
51
+ * Show the address that a person sends funds to, such as on a deposit screen.
52
+ * Let a person scan the address from another device or copy it.
53
+
54
+ #### When Not to Use
55
+
56
+ * Use [Hex](#hex) for an address inside a row or a sentence.
57
+ * Use [Qr](#qr) alone for a code that encodes something other than an address.
58
+
59
+ #### List Only the Accepted Networks
60
+
61
+ **Do:** List the networks that the address accepts.
62
+
63
+ ```tsx
64
+ <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2">
65
+ <AddressCard.Networks>
66
+ <AddressCard.Network network="tempo" selected>
67
+ Tempo
68
+ </AddressCard.Network>
69
+ <AddressCard.Network network="base">Base</AddressCard.Network>
70
+ </AddressCard.Networks>
71
+ </AddressCard>
72
+ ```
73
+
74
+ **Don't:** Leave out the networks when the address accepts only some of them.
75
+
76
+ ```tsx
77
+ <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2" />
78
+ ```
79
+
80
+ #### Keep the Full Address
81
+
82
+ Pass the whole address. The card shortens the text, and the copy button and QR code use the full value.
83
+
84
+ ### Content
85
+
86
+ * **Label:** Name the address from the reader's view, such as Your wallet address.
87
+ * **Networks:** Name each network as its brand does, such as Ethereum or Base.
88
+
89
+ ### Accessibility
90
+
91
+ The card renders a `<div>` with no role. Screen readers read the full address, the named QR code, the copy button, and the network group.
92
+
93
+ * **Address (Full value):** Screen readers read every character, not the shortened text.
94
+ * **Copy (button):** The copy button announces Copied after a copy.
95
+ * **Networks (group):** The label names the group of network chips.
96
+ * **Pick a Network (aria-pressed):** A chip with an onClick announces its selected state.
97
+
98
+ ### Related
99
+
100
+ [Hex](#hex)
101
+
102
+ Use for an address inside a row or a sentence.
103
+
104
+ [Qr](#qr)
105
+
106
+ Use for a QR code of another value.
107
+
108
+ [AssetChip](#assetchip)
109
+
110
+ Use for the chips of supported assets.
111
+
112
+ ### Examples
113
+
114
+ #### Basic
115
+
116
+ Pass the full `address`. The card shows its first and last four characters.
117
+
118
+ ```tsx
119
+ /** Demonstrates AddressCard in the documentation. @module */
120
+ import { AddressCard, style } from '@tempoxyz/ds'
121
+
122
+ export function Demo() {
123
+ return (
124
+ <div {...styles.frame()}>
125
+ <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2" />
126
+ </div>
127
+ )
128
+ }
129
+
130
+ namespace styles {
131
+ export const frame = style({ maxWidth: '28.75rem !custom', width: '100% !custom' })
132
+ }
133
+ ```
134
+
135
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AddressCard/Basic.tsx)
136
+
137
+ #### Networks
138
+
139
+ Add `AddressCard.Networks` with one `AddressCard.Network` per network. Set `selected` on the picked one.
140
+
141
+ ```tsx
142
+ /** Demonstrates AddressCard in the documentation. @module */
143
+ import { AddressCard, style } from '@tempoxyz/ds'
144
+
145
+ export function Demo() {
146
+ return (
147
+ <div {...styles.frame()}>
148
+ <AddressCard address="0x7a3f2c9b1e4d8a6f0c5b3e7d9a1f4c8e2b6d91c2">
149
+ <AddressCard.Networks>
150
+ <AddressCard.Network network="ethereum" selected>
151
+ Ethereum
152
+ </AddressCard.Network>
153
+ <AddressCard.Network network="base">Base</AddressCard.Network>
154
+ <AddressCard.Network network="solana">Solana</AddressCard.Network>
155
+ <AddressCard.Network network="tempo">Tempo</AddressCard.Network>
156
+ </AddressCard.Networks>
157
+ </AddressCard>
158
+ </div>
159
+ )
160
+ }
161
+
162
+ namespace styles {
163
+ export const frame = style({ maxWidth: '28.75rem !custom', width: '100% !custom' })
164
+ }
165
+ ```
166
+
167
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AddressCard/Networks.tsx)
168
+
169
+ ## Amount
170
+
171
+ Formats a number as money or a token amount.
172
+
173
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Amount.tsx)
174
+
175
+ ### Overview
176
+
177
+ Formats a number in `en-US` with tabular figures, as money or followed by a token symbol.
178
+
179
+ ### Anatomy
180
+
181
+ Import the component and assemble its parts.
182
+
183
+ ```tsx
184
+ import { Amount } from '@tempoxyz/ds'
185
+
186
+ <Amount />
187
+ ```
188
+
189
+ ### Guidelines
190
+
191
+ #### When to Use
192
+
193
+ * Show balances, payment amounts, fees, and converted values, such as 1,250.50 USDC or $1,250.50.
194
+ * Show amounts in tables, rows, and review screens with consistent formatting.
195
+
196
+ #### When Not to Use
197
+
198
+ * Use [AmountInput](forms-and-inputs.md#amountinput) when people enter an amount.
199
+ * Use `Table.Cell` with `numeric` in a [Table](data-display.md#table) for counts and metrics without a unit, such as TPS or block height.
200
+
201
+ #### Always Show the Unit
202
+
203
+ **Do:** Pass `symbol` for a token amount and `currency` for money.
204
+
205
+ ```tsx
206
+ /**
207
+ * Do example for "Always Show the Unit" on the Amount page.
208
+ * Pass `symbol` for a token amount and `currency` for money.
209
+ * @module
210
+ */
211
+ import { Amount, style } from '@tempoxyz/ds'
212
+
213
+ /** Renders the static preview, which the guideline card shows inert. */
214
+ export function Demo() {
215
+ return (
216
+ <div {...styles.stack()}>
217
+ <Amount size="md" symbol="USDC" value="1250.50" />
218
+ <Amount currency="USD" value="1250.50" />
219
+ </div>
220
+ )
221
+ }
222
+
223
+ namespace styles {
224
+ export const stack = style({ display: 'grid', gap: '4' })
225
+ }
226
+ ```
227
+
228
+ **Don't:** Show an amount without its token or currency.
229
+
230
+ ```tsx
231
+ /**
232
+ * Don't example for "Always Show the Unit" on the Amount page.
233
+ * Don't show an amount without its token or currency.
234
+ * @module
235
+ */
236
+ import { Amount, style } from '@tempoxyz/ds'
237
+
238
+ /** Renders the static preview, which the guideline card shows inert. */
239
+ export function Demo() {
240
+ return (
241
+ <div {...styles.stack()}>
242
+ <Amount size="md" value="1250.50" />
243
+ <Amount value="1250.50" />
244
+ </div>
245
+ )
246
+ }
247
+
248
+ namespace styles {
249
+ export const stack = style({ display: 'grid', gap: '4' })
250
+ }
251
+ ```
252
+
253
+ #### Choose Currency or Symbol
254
+
255
+ * **Currency:** Money and converted values, such as a portfolio total.
256
+ * **Symbol:** Token amounts, such as what an account holds or sends.
257
+
258
+ Show a stablecoin balance in its token, such as PathUSD, even if it tracks the dollar. If you have a rate, add a converted value with `currency` as a second line.
259
+
260
+ #### Pass Exact Decimal Strings
261
+
262
+ Pass `value` as a decimal string, such as a token balance converted from base units. Without `currency`, a string keeps its own fraction digits, including trailing zeros.
263
+
264
+ **Do:** Pass decimal strings, such as `"0.30"`.
265
+
266
+ ```tsx
267
+ /**
268
+ * Do example for "Pass Exact Decimal Strings" on the Amount page.
269
+ * Pass decimal strings, such as `"0.30"`.
270
+ * @module
271
+ */
272
+ import { Amount, style } from '@tempoxyz/ds'
273
+
274
+ /** Renders the static preview, which the guideline card shows inert. */
275
+ export function Demo() {
276
+ return (
277
+ <div {...styles.list()}>
278
+ <div {...styles.row()}>
279
+ <span {...styles.label()}>Available balance</span>
280
+ <Amount align="right" symbol="USDC" value="1250.10" />
281
+ </div>
282
+ <div {...styles.row()}>
283
+ <span {...styles.label()}>Total fees</span>
284
+ <Amount align="right" symbol="USDC" value="0.30" />
285
+ </div>
286
+ </div>
287
+ )
288
+ }
289
+
290
+ namespace styles {
291
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
292
+
293
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
294
+
295
+ export const row = style({
296
+ alignItems: 'baseline',
297
+ display: 'flex',
298
+ gap: '16',
299
+ justifyContent: 'space-between',
300
+ })
301
+ }
302
+ ```
303
+
304
+ **Don't:** Pass numbers. They drop trailing zeros and show floating-point errors.
305
+
306
+ ```tsx
307
+ /**
308
+ * Don't example for "Pass Exact Decimal Strings" on the Amount page.
309
+ * Don't pass numbers. They drop trailing zeros and show floating-point errors.
310
+ * @module
311
+ */
312
+ import { Amount, style } from '@tempoxyz/ds'
313
+
314
+ /** Renders the static preview, which the guideline card shows inert. */
315
+ export function Demo() {
316
+ return (
317
+ <div {...styles.list()}>
318
+ <div {...styles.row()}>
319
+ <span {...styles.label()}>Available balance</span>
320
+ <Amount align="right" symbol="USDC" value={1250.1} />
321
+ </div>
322
+ <div {...styles.row()}>
323
+ <span {...styles.label()}>Total fees</span>
324
+ <Amount align="right" symbol="USDC" value={0.1 + 0.2} />
325
+ </div>
326
+ </div>
327
+ )
328
+ }
329
+
330
+ namespace styles {
331
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
332
+
333
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
334
+
335
+ export const row = style({
336
+ alignItems: 'baseline',
337
+ display: 'flex',
338
+ gap: '16',
339
+ justifyContent: 'space-between',
340
+ })
341
+ }
342
+ ```
343
+
344
+ #### Set Decimals by Purpose
345
+
346
+ * **With `currency`:** Shows the currency's own digits, two for USD. `maxDecimals={0}` renders `$5`.
347
+ * **Without `currency`:** Shows every digit of the string. Set `maxDecimals` in lists, and show the exact value in details and review screens.
348
+ * **Rounding:** `0.999` with `maxDecimals={2}` renders `1.00`. Show the exact balance wherever people choose how much to send.
349
+
350
+ **Do:** Use one decimal count down a column so decimal points line up.
351
+
352
+ ```tsx
353
+ /**
354
+ * Do example for "Set Decimals by Purpose" on the Amount page.
355
+ * Use one decimal count down a column so decimal points line up.
356
+ * @module
357
+ */
358
+ import { Amount, style } from '@tempoxyz/ds'
359
+
360
+ /** Renders the static preview, which the guideline card shows inert. */
361
+ export function Demo() {
362
+ return (
363
+ <div {...styles.list()}>
364
+ <div {...styles.row()}>
365
+ <span {...styles.label()}>Main wallet</span>
366
+ <Amount align="right" symbol="USDC" value="1250.50" />
367
+ </div>
368
+ <div {...styles.row()}>
369
+ <span {...styles.label()}>Savings</span>
370
+ <Amount align="right" symbol="USDC" value="84.10" />
371
+ </div>
372
+ <div {...styles.row()}>
373
+ <span {...styles.label()}>Payroll</span>
374
+ <Amount align="right" symbol="USDC" value="312.00" />
375
+ </div>
376
+ </div>
377
+ )
378
+ }
379
+
380
+ namespace styles {
381
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
382
+
383
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
384
+
385
+ export const row = style({
386
+ alignItems: 'baseline',
387
+ display: 'flex',
388
+ gap: '16',
389
+ justifyContent: 'space-between',
390
+ })
391
+ }
392
+ ```
393
+
394
+ **Don't:** Mix decimal counts in one column.
395
+
396
+ ```tsx
397
+ /**
398
+ * Don't example for "Set Decimals by Purpose" on the Amount page.
399
+ * Don't mix decimal counts in one column.
400
+ * @module
401
+ */
402
+ import { Amount, style } from '@tempoxyz/ds'
403
+
404
+ /** Renders the static preview, which the guideline card shows inert. */
405
+ export function Demo() {
406
+ return (
407
+ <div {...styles.list()}>
408
+ <div {...styles.row()}>
409
+ <span {...styles.label()}>Main wallet</span>
410
+ <Amount align="right" symbol="USDC" value="1250.504812" />
411
+ </div>
412
+ <div {...styles.row()}>
413
+ <span {...styles.label()}>Savings</span>
414
+ <Amount align="right" symbol="USDC" value="84.1" />
415
+ </div>
416
+ <div {...styles.row()}>
417
+ <span {...styles.label()}>Payroll</span>
418
+ <Amount align="right" symbol="USDC" value="312.0005" />
419
+ </div>
420
+ </div>
421
+ )
422
+ }
423
+
424
+ namespace styles {
425
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
426
+
427
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
428
+
429
+ export const row = style({
430
+ alignItems: 'baseline',
431
+ display: 'flex',
432
+ gap: '16',
433
+ justifyContent: 'space-between',
434
+ })
435
+ }
436
+ ```
437
+
438
+ #### Show Values Below a Cent Precisely
439
+
440
+ A currency value below its smallest unit renders as a bound, such as `<$0.01`.
441
+
442
+ **Do:** Set `precise` on network fees to show two significant digits.
443
+
444
+ ```tsx
445
+ /**
446
+ * Do example for "Show Values Below a Cent Precisely" on the Amount page.
447
+ * Set `precise` on network fees to show two significant digits.
448
+ * @module
449
+ */
450
+ import { Amount, style } from '@tempoxyz/ds'
451
+
452
+ /** Renders the static preview, which the guideline card shows inert. */
453
+ export function Demo() {
454
+ return (
455
+ <div {...styles.list()}>
456
+ <div {...styles.row()}>
457
+ <span {...styles.label()}>You send</span>
458
+ <Amount align="right" symbol="USDC" value="250.00" />
459
+ </div>
460
+ <div {...styles.row()}>
461
+ <span {...styles.label()}>Network fee</span>
462
+ <Amount align="right" currency="USD" precise value="0.0004" />
463
+ </div>
464
+ </div>
465
+ )
466
+ }
467
+
468
+ namespace styles {
469
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
470
+
471
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
472
+
473
+ export const row = style({
474
+ alignItems: 'baseline',
475
+ display: 'flex',
476
+ gap: '16',
477
+ justifyContent: 'space-between',
478
+ })
479
+ }
480
+ ```
481
+
482
+ **Don't:** Show a fee people pay as a bound.
483
+
484
+ ```tsx
485
+ /**
486
+ * Don't example for "Show Values Below a Cent Precisely" on the Amount page.
487
+ * Don't show a fee people pay as a bound.
488
+ * @module
489
+ */
490
+ import { Amount, style } from '@tempoxyz/ds'
491
+
492
+ /** Renders the static preview, which the guideline card shows inert. */
493
+ export function Demo() {
494
+ return (
495
+ <div {...styles.list()}>
496
+ <div {...styles.row()}>
497
+ <span {...styles.label()}>You send</span>
498
+ <Amount align="right" symbol="USDC" value="250.00" />
499
+ </div>
500
+ <div {...styles.row()}>
501
+ <span {...styles.label()}>Network fee</span>
502
+ <Amount align="right" currency="USD" value="0.0004" />
503
+ </div>
504
+ </div>
505
+ )
506
+ }
507
+
508
+ namespace styles {
509
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
510
+
511
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
512
+
513
+ export const row = style({
514
+ alignItems: 'baseline',
515
+ display: 'flex',
516
+ gap: '16',
517
+ justifyContent: 'space-between',
518
+ })
519
+ }
520
+ ```
521
+
522
+ #### Show Direction With a Sign
523
+
524
+ Set `sign="+"` for money in and `sign="−"` for money out. Pass `value` without its own minus, or the amount shows two signs. Prefer the minus sign `−` to the hyphen `-`.
525
+
526
+ **Do:** Mark incoming and outgoing amounts with `+` and `−`.
527
+
528
+ ```tsx
529
+ /**
530
+ * Do example for "Show Direction With a Sign" on the Amount page.
531
+ * Mark incoming and outgoing amounts with `+` and `−`.
532
+ * @module
533
+ */
534
+ import { Amount, style } from '@tempoxyz/ds'
535
+
536
+ /** Renders the static preview, which the guideline card shows inert. */
537
+ export function Demo() {
538
+ return (
539
+ <div {...styles.list()}>
540
+ <div {...styles.row()}>
541
+ <span {...styles.label()}>Received from Jane</span>
542
+ <Amount align="right" sign="+" symbol="USDC" value="120.00" />
543
+ </div>
544
+ <div {...styles.row()}>
545
+ <span {...styles.label()}>Sent to 0x91bd…07e1</span>
546
+ <Amount align="right" sign="−" symbol="USDC" value="48.50" />
547
+ </div>
548
+ </div>
549
+ )
550
+ }
551
+
552
+ namespace styles {
553
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
554
+
555
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
556
+
557
+ export const row = style({
558
+ alignItems: 'baseline',
559
+ display: 'flex',
560
+ gap: '16',
561
+ justifyContent: 'space-between',
562
+ })
563
+ }
564
+ ```
565
+
566
+ **Don't:** Show direction with green and red alone.
567
+
568
+ ```tsx
569
+ /**
570
+ * Don't example for "Show Direction With a Sign" on the Amount page.
571
+ * Don't show direction with green and red alone.
572
+ * @module
573
+ */
574
+ import { style } from '@tempoxyz/ds'
575
+
576
+ /** Renders the static preview, which the guideline card shows inert. */
577
+ export function Demo() {
578
+ return (
579
+ <div {...styles.list()}>
580
+ <div {...styles.row()}>
581
+ <span {...styles.label()}>Received from Jane</span>
582
+ <span {...styles.credit()}>120.00 USDC</span>
583
+ </div>
584
+ <div {...styles.row()}>
585
+ <span {...styles.label()}>Sent to 0x91bd…07e1</span>
586
+ <span {...styles.debit()}>48.50 USDC</span>
587
+ </div>
588
+ </div>
589
+ )
590
+ }
591
+
592
+ namespace styles {
593
+ export const credit = style({
594
+ color: 'content.positive',
595
+ fontVariantNumeric: 'tabular-nums !custom',
596
+ typography: 'body.b2Strong',
597
+ })
598
+
599
+ export const debit = style({
600
+ color: 'content.negative',
601
+ fontVariantNumeric: 'tabular-nums !custom',
602
+ typography: 'body.b2Strong',
603
+ })
604
+
605
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
606
+
607
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
608
+
609
+ export const row = style({
610
+ alignItems: 'baseline',
611
+ display: 'flex',
612
+ gap: '16',
613
+ justifyContent: 'space-between',
614
+ })
615
+ }
616
+ ```
617
+
618
+ #### Mark Superseded Amounts in Words
619
+
620
+ Use `strikethrough` for an amount that no longer applies, such as an expired fee quote, and show the new amount beside it.
621
+
622
+ **Do:** Say it in text, such as Was $0.02.
623
+
624
+ ```tsx
625
+ /**
626
+ * Do example for "Mark Superseded Amounts in Words" on the Amount page.
627
+ * Say it in text, such as Was $0.02.
628
+ * @module
629
+ */
630
+ import { Amount, style } from '@tempoxyz/ds'
631
+
632
+ /** Renders the static preview, which the guideline card shows inert. */
633
+ export function Demo() {
634
+ return (
635
+ <div {...styles.row()}>
636
+ <span {...styles.label()}>Network fee</span>
637
+ <div {...styles.values()}>
638
+ <span {...styles.label()}>Was</span>
639
+ <Amount currency="USD" strikethrough value="0.02" />
640
+ <Amount currency="USD" value="0.01" />
641
+ </div>
642
+ </div>
643
+ )
644
+ }
645
+
646
+ namespace styles {
647
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
648
+
649
+ export const row = style({
650
+ alignItems: 'baseline',
651
+ display: 'flex',
652
+ gap: '16',
653
+ justifyContent: 'space-between',
654
+ width: '100% !custom',
655
+ })
656
+
657
+ export const values = style({ alignItems: 'baseline', display: 'flex', gap: '8' })
658
+ }
659
+ ```
660
+
661
+ **Don't:** Rely on the line. Screen readers don't announce it.
662
+
663
+ ```tsx
664
+ /**
665
+ * Don't example for "Mark Superseded Amounts in Words" on the Amount page.
666
+ * Don't rely on the line. Screen readers don't announce it.
667
+ * @module
668
+ */
669
+ import { Amount, style } from '@tempoxyz/ds'
670
+
671
+ /** Renders the static preview, which the guideline card shows inert. */
672
+ export function Demo() {
673
+ return (
674
+ <div {...styles.row()}>
675
+ <span {...styles.label()}>Network fee</span>
676
+ <div {...styles.values()}>
677
+ <Amount currency="USD" strikethrough value="0.02" />
678
+ <Amount currency="USD" value="0.01" />
679
+ </div>
680
+ </div>
681
+ )
682
+ }
683
+
684
+ namespace styles {
685
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
686
+
687
+ export const row = style({
688
+ alignItems: 'baseline',
689
+ display: 'flex',
690
+ gap: '16',
691
+ justifyContent: 'space-between',
692
+ width: '100% !custom',
693
+ })
694
+
695
+ export const values = style({ alignItems: 'baseline', display: 'flex', gap: '8' })
696
+ }
697
+ ```
698
+
699
+ #### Mask the Value, Not Its Look
700
+
701
+ Set `masked` on every amount while balances are hidden, including totals and converted values. Every masked amount shows the same six dots, which reveal neither its size nor its unit.
702
+
703
+ **Do:** Set `masked`, which renders the mask in place of the value.
704
+
705
+ ```tsx
706
+ /**
707
+ * Do example for "Mask the Value, Not Its Look" on the Amount page.
708
+ * Set `masked`, which renders a fixed mask in place of the value.
709
+ * @module
710
+ */
711
+ import { Amount, style } from '@tempoxyz/ds'
712
+
713
+ /** Renders the static preview, which the guideline card shows inert. */
714
+ export function Demo() {
715
+ return (
716
+ <div {...styles.row()}>
717
+ <span {...styles.label()}>Balance</span>
718
+ <Amount masked size="md" symbol="PathUSD" value="1240.50" />
719
+ </div>
720
+ )
721
+ }
722
+
723
+ namespace styles {
724
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
725
+
726
+ export const row = style({
727
+ alignItems: 'baseline',
728
+ display: 'flex',
729
+ gap: '16',
730
+ justifyContent: 'space-between',
731
+ width: '100% !custom',
732
+ })
733
+ }
734
+ ```
735
+
736
+ **Don't:** Blur the amount. People can still select and copy it.
737
+
738
+ ```tsx
739
+ /**
740
+ * Don't example for "Mask the Value, Not Its Look" on the Amount page.
741
+ * Don't blur the amount. The value stays in the page, where people can select and copy it.
742
+ * @module
743
+ */
744
+ import { Amount, style } from '@tempoxyz/ds'
745
+
746
+ /** Renders the static preview, which the guideline card shows inert. */
747
+ export function Demo() {
748
+ return (
749
+ <div {...styles.row()}>
750
+ <span {...styles.label()}>Balance</span>
751
+ <Amount {...styles.blurred()} size="md" symbol="PathUSD" value="1240.50" />
752
+ </div>
753
+ )
754
+ }
755
+
756
+ namespace styles {
757
+ export const blurred = style({ filter: 'blur(6px) !custom' })
758
+
759
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
760
+
761
+ export const row = style({
762
+ alignItems: 'baseline',
763
+ display: 'flex',
764
+ gap: '16',
765
+ justifyContent: 'space-between',
766
+ width: '100% !custom',
767
+ })
768
+ }
769
+ ```
770
+
771
+ #### Size by Importance
772
+
773
+ * **Small (sm):** The default, for lists, tables, and rows.
774
+ * **Medium (md):** Card values and review totals.
775
+ * **Large (lg):** A balance at the top of a page.
776
+ * **Extra Large (xl):** The single balance on a home screen.
777
+
778
+ Amount renders as a block and ignores the alignment of a table cell. Set `align="right"` in an end-aligned column.
779
+
780
+ ### Content
781
+
782
+ * Label each amount by its role, such as You send, Network fee, or Available balance.
783
+ * Don't repeat the unit in text, such as USD after $1,250.50.
784
+ * Don't abbreviate amounts people act on, such as 1.2K.
785
+ * Keep the label of a masked amount, such as Available balance, so people know what it hides.
786
+
787
+ ### Accessibility
788
+
789
+ Renders a `<span>` with no role. Screen readers read the formatted text as written, or Hidden for a masked amount. How they read symbols, such as `$`, `−`, or the `<` in `<$0.01`, depends on the screen reader and its settings.
790
+
791
+ #### Semantics
792
+
793
+ * **Root (span):** Plain text. Screen readers read the number with its sign and unit.
794
+ * **Locale (locale):** Formats in `en-US`. Set `locale` to the page language for other separators.
795
+ * **Strikethrough (strikethrough):** Visual only. Say in text that an amount is superseded.
796
+ * **Masked (masked):** Reads Hidden instead of the dots. The value is absent from the page.
797
+
798
+ #### Your Responsibilities
799
+
800
+ * **Mark Inexact Amounts:** Say in text if an amount is a bound or estimate, such as "Less than $0.01".
801
+ * **Announce Live Updates (aria-live):** Amount does not announce updates. Put awaited ones, such as a quote, in a live region.
802
+ * **Label Direction in Words:** Keep the sign, and label direction in words, such as "Received" and "Sent".
803
+
804
+ ### Related
805
+
806
+ [AmountInput](forms-and-inputs.md#amountinput)
807
+
808
+ Use for entering amounts.
809
+
810
+ [TokenLogo](#tokenlogo)
811
+
812
+ Use for the token icon beside an amount.
813
+
814
+ [Table](data-display.md#table)
815
+
816
+ Use for laying out amounts.
817
+
818
+ [ListGroup](data-display.md#listgroup)
819
+
820
+ Use for laying out amounts.
821
+
822
+ [Payments](../patterns.md#payments)
823
+
824
+ Covers send and review screens.
825
+
826
+ [Blockchain Values](../patterns.md#blockchain-values)
827
+
828
+ Covers token amounts and fees.
829
+
830
+ ### Examples
831
+
832
+ #### Basic
833
+
834
+ ```tsx
835
+ import { Amount } from '@tempoxyz/ds'
836
+
837
+ export function Demo() {
838
+ return <Amount symbol="PathUSD" value="1250.50" />
839
+ }
840
+ ```
841
+
842
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Basic.tsx)
843
+
844
+ #### Size
845
+
846
+ Set `size` to `sm` (default), `md`, `lg`, or `xl`.
847
+
848
+ ```tsx
849
+ import { Amount, style } from '@tempoxyz/ds'
850
+
851
+ export const fill = true
852
+ export function Demo() {
853
+ return (
854
+ <div {...styles.stack()}>
855
+ {(['sm', 'md', 'lg', 'xl'] as const).map((size) => (
856
+ <Amount key={size} size={size} symbol="PathUSD" value={1250.5} />
857
+ ))}
858
+ </div>
859
+ )
860
+ }
861
+
862
+ namespace styles {
863
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
864
+ }
865
+ ```
866
+
867
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Size.tsx)
868
+
869
+ #### Currency
870
+
871
+ Set `currency` to an ISO 4217 code for money, or `symbol` to follow the number with a token symbol. Pass one, not both.
872
+
873
+ ```tsx
874
+ import { Amount, style } from '@tempoxyz/ds'
875
+
876
+ export const fill = true
877
+ export function Demo() {
878
+ return (
879
+ <div {...styles.stack()}>
880
+ <Amount currency="USD" size="lg" value={1234.5} />
881
+ <Amount currency="EUR" value={1234.5} />
882
+ <Amount size="lg" symbol="PathUSD" value={1234.5} />
883
+ </div>
884
+ )
885
+ }
886
+
887
+ namespace styles {
888
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
889
+ }
890
+ ```
891
+
892
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Currency.tsx)
893
+
894
+ #### Align
895
+
896
+ Set `align` to `left` (default), `center`, or `right`.
897
+
898
+ ```tsx
899
+ import { Amount, style } from '@tempoxyz/ds'
900
+
901
+ export const fill = true
902
+ export function Demo() {
903
+ return (
904
+ <div {...styles.stack()}>
905
+ {(['left', 'center', 'right'] as const).map((align) => (
906
+ <Amount align={align} currency="USD" key={align} size="md" value={1234.5} />
907
+ ))}
908
+ </div>
909
+ )
910
+ }
911
+
912
+ namespace styles {
913
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
914
+ }
915
+ ```
916
+
917
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Align.tsx)
918
+
919
+ #### Sign
920
+
921
+ Set `sign` to `+`, `-`, or `−` to prefix the amount.
922
+
923
+ ```tsx
924
+ import { Amount, style } from '@tempoxyz/ds'
925
+
926
+ export const fill = true
927
+ export function Demo() {
928
+ return (
929
+ <div {...styles.stack()}>
930
+ <Amount align="center" sign="+" size="md" symbol="PathUSD" value="1250.50" />
931
+ <Amount align="right" currency="USD" sign="−" size="md" value={1234.5} />
932
+ </div>
933
+ )
934
+ }
935
+
936
+ namespace styles {
937
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
938
+ }
939
+ ```
940
+
941
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Sign.tsx)
942
+
943
+ #### Strikethrough
944
+
945
+ Set `strikethrough` to mark a superseded amount.
946
+
947
+ ```tsx
948
+ import { Amount, style } from '@tempoxyz/ds'
949
+
950
+ export const fill = true
951
+ export function Demo() {
952
+ return (
953
+ <div {...styles.stack()}>
954
+ <Amount size="md" strikethrough symbol="PathUSD" value={1250.5} />
955
+ </div>
956
+ )
957
+ }
958
+
959
+ namespace styles {
960
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
961
+ }
962
+ ```
963
+
964
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Strikethrough.tsx)
965
+
966
+ #### Precise
967
+
968
+ Set `precise` to show two significant digits for a currency value below the smallest shown unit.
969
+
970
+ ```tsx
971
+ import { Amount, style } from '@tempoxyz/ds'
972
+
973
+ export const fill = true
974
+ export function Demo() {
975
+ return (
976
+ <div {...styles.stack()}>
977
+ <Amount currency="USD" value={0.0004} />
978
+ <Amount currency="USD" precise value={0.0004} />
979
+ </div>
980
+ )
981
+ }
982
+
983
+ namespace styles {
984
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
985
+ }
986
+ ```
987
+
988
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Precise.tsx)
989
+
990
+ #### Max Decimals
991
+
992
+ Set `maxDecimals` to cap the fraction digits shown.
993
+
994
+ ```tsx
995
+ import { Amount, style } from '@tempoxyz/ds'
996
+
997
+ export const fill = true
998
+ export function Demo() {
999
+ return (
1000
+ <div {...styles.stack()}>
1001
+ <Amount symbol="PathUSD" value="1.23456" />
1002
+ <Amount maxDecimals={2} symbol="PathUSD" value="1.23456" />
1003
+ </div>
1004
+ )
1005
+ }
1006
+
1007
+ namespace styles {
1008
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
1009
+ }
1010
+ ```
1011
+
1012
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/MaxDecimals.tsx)
1013
+
1014
+ #### Locale
1015
+
1016
+ Set `locale` to a BCP 47 tag, such as `de-DE`, to change grouping, decimal marks, and currency symbols. It defaults to `en-US`, so server and browser render the same text.
1017
+
1018
+ ```tsx
1019
+ import { Amount, style } from '@tempoxyz/ds'
1020
+
1021
+ export const fill = true
1022
+ export function Demo() {
1023
+ return (
1024
+ <div {...styles.stack()}>
1025
+ <Amount currency="USD" value="1250.50" />
1026
+ <Amount currency="USD" locale="de-DE" value="1250.50" />
1027
+ </div>
1028
+ )
1029
+ }
1030
+
1031
+ namespace styles {
1032
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
1033
+ }
1034
+ ```
1035
+
1036
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Locale.tsx)
1037
+
1038
+ #### Masked
1039
+
1040
+ Set `masked` to show six dots in place of the amount, such as while people hide their balances. The value stays out of the page, so nobody can read, select, or copy it.
1041
+
1042
+ ```tsx
1043
+ import { Amount, style } from '@tempoxyz/ds'
1044
+
1045
+ export const fill = true
1046
+ export function Demo() {
1047
+ return (
1048
+ <div {...styles.stack()}>
1049
+ <Amount currency="USD" size="lg" value="2097.75" />
1050
+ <Amount currency="USD" masked size="lg" value="2097.75" />
1051
+ <Amount masked symbol="PathUSD" value="1240.50" />
1052
+ </div>
1053
+ )
1054
+ }
1055
+
1056
+ namespace styles {
1057
+ export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
1058
+ }
1059
+ ```
1060
+
1061
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Masked.tsx)
1062
+
1063
+ ## AssetChip
1064
+
1065
+ Labels a supported asset or network in a small chip, which can also pick one.
1066
+
1067
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AssetChip.tsx)
1068
+
1069
+ Figma: [Elements/Asset Chip](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-2626)
1070
+
1071
+ ### Overview
1072
+
1073
+ An asset chip renders a small gray label for something a row or value supports, such as the assets a network accepts. Place a [TokenLogo](#tokenlogo) before the text to add a 12px token logo. Give it an `onClick` to pick one asset from a short set.
1074
+
1075
+ ### Anatomy
1076
+
1077
+ Import the component and assemble its parts.
1078
+
1079
+ ```tsx
1080
+ import { AssetChip, TokenLogo } from '@tempoxyz/ds'
1081
+
1082
+ <AssetChip>
1083
+ <TokenLogo />
1084
+ </AssetChip>
1085
+ ```
1086
+
1087
+ ### Guidelines
1088
+
1089
+ #### When to Use
1090
+
1091
+ * List the assets a network supports under the title of a network row.
1092
+ * Name a supported asset after a value, such as an address that accepts USDC.
1093
+ * Pick one asset from a short set, such as the asset to pay with.
1094
+
1095
+ #### When Not to Use
1096
+
1097
+ * Use [Badge](data-display.md#badge) to show a status, such as Pending.
1098
+ * Use [Token](#token-1) for a token that a person can change.
1099
+ * Use [Button](actions.md#button) for an action other than picking an asset.
1100
+
1101
+ #### List What a Row Supports
1102
+
1103
+ Asset chips stay quiet, so they don't compete with the row title or with status tags.
1104
+
1105
+ **Do:** Place the chips under the row title, one per supported asset.
1106
+
1107
+ ```tsx
1108
+ /**
1109
+ * Do example for "List What a Row Supports" on the AssetChip page.
1110
+ * Place asset chips under the title of a network row.
1111
+ * @module
1112
+ */
1113
+ import { AssetChip, NetworkLogo, style } from '@tempoxyz/ds'
1114
+
1115
+ /** Renders the static preview, which the guideline card shows inert. */
1116
+ export function Demo() {
1117
+ return (
1118
+ <div {...styles.row()}>
1119
+ <NetworkLogo network="base" size="large" />
1120
+ <div {...styles.text()}>
1121
+ <span {...styles.title()}>Base</span>
1122
+ <div {...styles.chips()}>
1123
+ <AssetChip>USDC</AssetChip>
1124
+ <AssetChip>USDT</AssetChip>
1125
+ </div>
1126
+ </div>
1127
+ </div>
1128
+ )
1129
+ }
1130
+
1131
+ namespace styles {
1132
+ export const chips = style({ display: 'flex', gap: '4' })
1133
+
1134
+ // The row sits on a modal's elevated surface, as in the designs, so the chips keep their fill.
1135
+ export const row = style({
1136
+ alignItems: 'center',
1137
+ backgroundColor: 'background.elevated',
1138
+ borderRadius: 'xs',
1139
+ display: 'flex',
1140
+ gap: '12',
1141
+ padding: '16',
1142
+ })
1143
+
1144
+ export const text = style({ display: 'grid', gap: '4' })
1145
+
1146
+ export const title = style({ color: 'content.primary', typography: 'body.b2Strong' })
1147
+ }
1148
+ ```
1149
+
1150
+ **Don't:** Use an asset chip to show a status. Use a [Badge](data-display.md#badge).
1151
+
1152
+ ```tsx
1153
+ /**
1154
+ * Don't example for "List What a Row Supports" on the AssetChip page.
1155
+ * An asset chip used as a status reads as a supported asset.
1156
+ * @module
1157
+ */
1158
+ import { AssetChip, NetworkLogo, style } from '@tempoxyz/ds'
1159
+
1160
+ /** Renders the static preview, which the guideline card shows inert. */
1161
+ export function Demo() {
1162
+ return (
1163
+ <div {...styles.row()}>
1164
+ <NetworkLogo network="base" size="large" />
1165
+ <div {...styles.text()}>
1166
+ <span {...styles.title()}>Base</span>
1167
+ <div {...styles.chips()}>
1168
+ <AssetChip>Congested</AssetChip>
1169
+ </div>
1170
+ </div>
1171
+ </div>
1172
+ )
1173
+ }
1174
+
1175
+ namespace styles {
1176
+ export const chips = style({ display: 'flex', gap: '4' })
1177
+
1178
+ // The row sits on a modal's elevated surface, as in the designs, so the chips keep their fill.
1179
+ export const row = style({
1180
+ alignItems: 'center',
1181
+ backgroundColor: 'background.elevated',
1182
+ borderRadius: 'xs',
1183
+ display: 'flex',
1184
+ gap: '12',
1185
+ padding: '16',
1186
+ })
1187
+
1188
+ export const text = style({ display: 'grid', gap: '4' })
1189
+
1190
+ export const title = style({ color: 'content.primary', typography: 'body.b2Strong' })
1191
+ }
1192
+ ```
1193
+
1194
+ #### Add a Logo Only When It Helps
1195
+
1196
+ * **Text:** The default, for a list of familiar assets.
1197
+ * **Logo:** For an asset that people find by its logo.
1198
+
1199
+ ### Content
1200
+
1201
+ #### Use the Symbol
1202
+
1203
+ Write the asset's ticker symbol, such as USDC or pathUSD, or the network's name, such as Base. Don't add words such as Supported or Accepted. The row title gives that context.
1204
+
1205
+ ### Accessibility
1206
+
1207
+ An asset chip renders a `<span>` with no role, so screen readers read its text inline. With an `onClick`, it renders a `<button>` that takes focus and announces `selected` as pressed.
1208
+
1209
+ #### Semantics
1210
+
1211
+ * **Root (span):** Screen readers read its text in place, as part of the surrounding content.
1212
+ * **Logo (alt):** A nested token logo has empty alt text, so screen readers read the symbol once, from the chip text.
1213
+ * **Selected (aria-pressed):** A chip with an `onClick` announces `selected` as pressed, so screen readers read the pick.
1214
+
1215
+ #### Keyboard
1216
+
1217
+ A static chip takes no focus. A chip with an `onClick` is a native button:
1218
+
1219
+ * **Move Focus to the Chip (Tab):** Moves focus to the next chip in the set.
1220
+ * **Pick the Asset (Enter or Space):** Runs the chip's `onClick`, which sets the picked asset.
1221
+
1222
+ #### Your Responsibilities
1223
+
1224
+ * **Keep Chips Beside Their Row:** Keep the chips next to the row title, so screen readers read the assets with it.
1225
+ * **Name the Set (aria-label):** Wrap selectable chips in a group with a label, so screen readers read what they pick.
1226
+
1227
+ ### Related
1228
+
1229
+ [TokenLogo](#tokenlogo)
1230
+
1231
+ Use for token logos.
1232
+
1233
+ [Token](#token-1)
1234
+
1235
+ Use for a token that a person can change.
1236
+
1237
+ [NetworkLogo](#networklogo)
1238
+
1239
+ Use for network logos.
1240
+
1241
+ [Badge](data-display.md#badge)
1242
+
1243
+ Use for statuses.
1244
+
1245
+ [ListGroup](data-display.md#listgroup)
1246
+
1247
+ Use for network and asset lists.
1248
+
1249
+ ### Examples
1250
+
1251
+ #### Basic
1252
+
1253
+ ```tsx
1254
+ import { AssetChip, style } from '@tempoxyz/ds'
1255
+
1256
+ export function Demo() {
1257
+ return (
1258
+ <div {...styles.row()}>
1259
+ <AssetChip>USDC</AssetChip>
1260
+ <AssetChip>USDT</AssetChip>
1261
+ </div>
1262
+ )
1263
+ }
1264
+
1265
+ namespace styles {
1266
+ // Chips sit on a modal's elevated surface in the designs, and share the page's fill otherwise.
1267
+ export const row = style({
1268
+ alignItems: 'center',
1269
+ backgroundColor: 'background.elevated',
1270
+ borderRadius: 'xs',
1271
+ display: 'flex',
1272
+ gap: '4',
1273
+ padding: '16',
1274
+ })
1275
+ }
1276
+ ```
1277
+
1278
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AssetChip/Basic.tsx)
1279
+
1280
+ #### Logo
1281
+
1282
+ A nested [TokenLogo](#tokenlogo) renders at 12px, whatever its `size`.
1283
+
1284
+ ```tsx
1285
+ import { AssetChip, style, TokenLogo } from '@tempoxyz/ds'
1286
+
1287
+ export function Demo() {
1288
+ return (
1289
+ <TokenLogo.Provider>
1290
+ <div {...styles.row()}>
1291
+ <AssetChip>
1292
+ <TokenLogo address="0x20c0000000000000000000000000000000000000" />
1293
+ pathUSD
1294
+ </AssetChip>
1295
+ <AssetChip>
1296
+ <TokenLogo address="0x20c000000000000000000000b9537d11c60e8b50" />
1297
+ USDC.e
1298
+ </AssetChip>
1299
+ </div>
1300
+ </TokenLogo.Provider>
1301
+ )
1302
+ }
1303
+
1304
+ namespace styles {
1305
+ // Chips sit on a modal's elevated surface in the designs, and share the page's fill otherwise.
1306
+ export const row = style({
1307
+ alignItems: 'center',
1308
+ backgroundColor: 'background.elevated',
1309
+ borderRadius: 'xs',
1310
+ display: 'flex',
1311
+ gap: '4',
1312
+ padding: '16',
1313
+ })
1314
+ }
1315
+ ```
1316
+
1317
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AssetChip/Logo.tsx)
1318
+
1319
+ #### Selectable
1320
+
1321
+ An `onClick` renders a button. Set `selected` on the picked chip, which fills dark.
1322
+
1323
+ ```tsx
1324
+ import { AssetChip, style } from '@tempoxyz/ds'
1325
+ import { useState } from 'react'
1326
+
1327
+ const assets = ['USDC', 'USDT', 'pathUSD'] as const
1328
+
1329
+ export function Demo() {
1330
+ const [asset, setAsset] = useState<(typeof assets)[number]>(assets[0])
1331
+
1332
+ return (
1333
+ <div aria-label="Pay with" role="group" {...styles.row()}>
1334
+ {assets.map((entry) => (
1335
+ <AssetChip key={entry} onClick={() => setAsset(entry)} selected={asset === entry}>
1336
+ {entry}
1337
+ </AssetChip>
1338
+ ))}
1339
+ </div>
1340
+ )
1341
+ }
1342
+
1343
+ namespace styles {
1344
+ // Chips sit on a modal's elevated surface in the designs, and share the page's fill otherwise.
1345
+ export const row = style({
1346
+ alignItems: 'center',
1347
+ backgroundColor: 'background.elevated',
1348
+ borderRadius: 'xs',
1349
+ display: 'flex',
1350
+ gap: '4',
1351
+ padding: '16',
1352
+ })
1353
+ }
1354
+ ```
1355
+
1356
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AssetChip/Selectable.tsx)
1357
+
1358
+ ## BadgedLogo
1359
+
1360
+ Marks a token or an app with a small badge on the corner of its logo.
1361
+
1362
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/BadgedLogo.tsx)
1363
+
1364
+ Figma: [Elements/Badged Logo](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5606-2531) (`BadgedLogo.Root`)
1365
+
1366
+ ### Overview
1367
+
1368
+ A badged logo insets a 44px logo in a 56px box and overlaps its lower trailing corner with a 20px badge. The badge holds one icon, such as an arrow that marks the destination of a transfer.
1369
+
1370
+ ### Anatomy
1371
+
1372
+ Import the component and assemble its parts.
1373
+
1374
+ ```tsx
1375
+ import { BadgedLogo } from '@tempoxyz/ds'
1376
+
1377
+ <BadgedLogo.Root>
1378
+ <BadgedLogo.Tile />
1379
+ <BadgedLogo.Badge />
1380
+ </BadgedLogo.Root>
1381
+ ```
1382
+
1383
+ ### Guidelines
1384
+
1385
+ #### When to Use
1386
+
1387
+ * Mark the token or the app at one end of a transfer, such as the destination of a send.
1388
+
1389
+ #### When Not to Use
1390
+
1391
+ * Use [TokenLogo](#tokenlogo) for a token without a badge.
1392
+ * Use [Avatar](data-display.md#avatar) for a person, a contact, or a wallet.
1393
+ * Use [IconTile](data-display.md#icontile) for one icon above the title of a modal.
1394
+
1395
+ #### Put the Logo First and the Badge Last
1396
+
1397
+ Pass one logo, then one `BadgedLogo.Badge`. The root sizes the logo to 44px, so leave its size unset.
1398
+
1399
+ #### Use One Small Icon in the Badge
1400
+
1401
+ The badge centers one 12px icon in the primary color. Do not put text or a second icon in it.
1402
+
1403
+ ### Content
1404
+
1405
+ Fill a `BadgedLogo.Tile` with the first letter of the app's name, in uppercase.
1406
+
1407
+ ### Accessibility
1408
+
1409
+ A badged logo renders `<span>` elements with no role and takes no focus.
1410
+
1411
+ * **Logo (img):** A token logo with `alt` announces its name.
1412
+ * **Badge (aria-hidden):** An icon without `aria-label` stays hidden.
1413
+ * **Meaning in Text:** Name what the badge means in text beside it.
1414
+
1415
+ ### Related
1416
+
1417
+ [TokenLogo](#tokenlogo)
1418
+
1419
+ Use for a token logo without a badge.
1420
+
1421
+ [Avatar](data-display.md#avatar)
1422
+
1423
+ Use for people, contacts, and wallets.
1424
+
1425
+ [IconTile](data-display.md#icontile)
1426
+
1427
+ Use for one icon above the title of a modal.
1428
+
1429
+ ### Examples
1430
+
1431
+ #### Token
1432
+
1433
+ ```tsx
1434
+ /** Renders a token logo with an arrow badge on the BadgedLogo page. @module */
1435
+ import { BadgedLogo, TokenLogo } from '@tempoxyz/ds'
1436
+ import { ArrowRight } from '@tempoxyz/ds/icons'
1437
+
1438
+ export function Demo() {
1439
+ return (
1440
+ <BadgedLogo.Root>
1441
+ <TokenLogo symbol="USDC" />
1442
+ <BadgedLogo.Badge>
1443
+ <ArrowRight />
1444
+ </BadgedLogo.Badge>
1445
+ </BadgedLogo.Root>
1446
+ )
1447
+ }
1448
+ ```
1449
+
1450
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/BadgedLogo/Basic.tsx)
1451
+
1452
+ #### App
1453
+
1454
+ An app without artwork takes a tile with the first letter of its name.
1455
+
1456
+ ```tsx
1457
+ /** Renders an app tile with an arrow badge on the BadgedLogo page. @module */
1458
+ import { BadgedLogo } from '@tempoxyz/ds'
1459
+ import { ArrowRight } from '@tempoxyz/ds/icons'
1460
+
1461
+ export function Demo() {
1462
+ return (
1463
+ <BadgedLogo.Root>
1464
+ <BadgedLogo.Tile>A</BadgedLogo.Tile>
1465
+ <BadgedLogo.Badge>
1466
+ <ArrowRight />
1467
+ </BadgedLogo.Badge>
1468
+ </BadgedLogo.Root>
1469
+ )
1470
+ }
1471
+ ```
1472
+
1473
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/BadgedLogo/App.tsx)
1474
+
1475
+ ## Hex
1476
+
1477
+ Shows a hex string, such as an address, truncated to fit.
1478
+
1479
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Hex.tsx)
1480
+
1481
+ ### Overview
1482
+
1483
+ Hex shows a hex string, such as an address or hash, middle-truncated to fit its container. Both ends stay visible, and screen readers read the full value.
1484
+
1485
+ ### Anatomy
1486
+
1487
+ Import the component and assemble its parts.
1488
+
1489
+ ```tsx
1490
+ import { Hex } from '@tempoxyz/ds'
1491
+
1492
+ <Hex />
1493
+
1494
+ <Hex.Root>
1495
+ <Hex.Text />
1496
+ <Hex.Copy />
1497
+ </Hex.Root>
1498
+ ```
1499
+
1500
+ ### Guidelines
1501
+
1502
+ #### When to Use
1503
+
1504
+ * Show an address or transaction hash in a row, table, or card where it may not fit.
1505
+ * Show a receive address as a standalone field with `variant="filled"`. The whole row copies.
1506
+ * Show every character with `truncate={false}` where people check or select the value by hand, such as a receive address.
1507
+
1508
+ #### When Not to Use
1509
+
1510
+ * Use [SecretValue](#secretvalue) for private keys and other secrets. Hex shows its value in the clear.
1511
+ * Use [Snippet](data-display.md#snippet) for URLs, commands, and other values that aren't hex.
1512
+ * Use [CopyButton](actions.md#copybutton) alone when the value isn't displayed.
1513
+
1514
+ #### Always Offer Copy
1515
+
1516
+ Set `copy` wherever people need the full value. To name the button, compose the parts and pass `aria-label` to `Hex.Copy`. Link a transaction hash to its block explorer page for verification.
1517
+
1518
+ ```tsx
1519
+ <Hex.Root value={address}>
1520
+ <Hex.Text />
1521
+ <Hex.Copy aria-label="Copy address" />
1522
+ </Hex.Root>
1523
+ ```
1524
+
1525
+ **Do:** Add a copy button, named by what it copies.
1526
+
1527
+ ```tsx
1528
+ /** Do example for "Always Offer Copy" on the Hex page: add a copy button, named by what it copies. @module */
1529
+ import { Hex } from '@tempoxyz/ds'
1530
+
1531
+ /** Renders the static preview, which the guideline card shows inert. */
1532
+ export function Demo() {
1533
+ return (
1534
+ <Hex.Root value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060">
1535
+ <Hex.Text />
1536
+ <Hex.Copy aria-label="Copy transaction hash" />
1537
+ </Hex.Root>
1538
+ )
1539
+ }
1540
+ ```
1541
+
1542
+ **Don't:** Show a truncated value without a way to copy it.
1543
+
1544
+ ```tsx
1545
+ /**
1546
+ * Don't example for "Always Offer Copy" on the Hex page.
1547
+ * Don't show a truncated value without a way to copy it.
1548
+ * @module
1549
+ */
1550
+ import { Hex } from '@tempoxyz/ds'
1551
+
1552
+ /** Renders the static preview, which the guideline card shows inert. */
1553
+ export function Demo() {
1554
+ return <Hex value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060" />
1555
+ }
1556
+ ```
1557
+
1558
+ #### Truncate in the Middle
1559
+
1560
+ People check an address by its first and last characters. For plain strings, such as a [Toast](feedback-and-status.md#toast) message, `formatHex` keeps both ends too.
1561
+
1562
+ **Do:** Keep both ends of the value visible.
1563
+
1564
+ ```tsx
1565
+ /** Do example for "Truncate in the Middle" on the Hex page: keep both ends of the value visible. @module */
1566
+ import { Hex, style } from '@tempoxyz/ds'
1567
+
1568
+ /** Renders the static preview, which the guideline card shows inert. */
1569
+ export function Demo() {
1570
+ return (
1571
+ <div {...styles.frame()}>
1572
+ <Hex copy value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
1573
+ </div>
1574
+ )
1575
+ }
1576
+
1577
+ namespace styles {
1578
+ export const frame = style({ maxWidth: '100% !custom', width: '12rem !custom' })
1579
+ }
1580
+ ```
1581
+
1582
+ **Don't:** Truncate the end of an address with an ellipsis.
1583
+
1584
+ ```tsx
1585
+ /**
1586
+ * Don't example for "Truncate in the Middle" on the Hex page.
1587
+ * Don't truncate the end of an address with an ellipsis.
1588
+ * @module
1589
+ */
1590
+ import { style } from '@tempoxyz/ds'
1591
+
1592
+ /** Renders the static preview, which the guideline card shows inert. */
1593
+ export function Demo() {
1594
+ return <span {...styles.text()}>0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045</span>
1595
+ }
1596
+
1597
+ namespace styles {
1598
+ export const text = style({
1599
+ color: 'content.primary',
1600
+ display: 'block',
1601
+ maxWidth: '100% !custom',
1602
+ overflow: 'hidden',
1603
+ textOverflow: 'ellipsis !custom',
1604
+ typography: 'mono.m1',
1605
+ whiteSpace: 'nowrap',
1606
+ width: '12rem !custom',
1607
+ })
1608
+ }
1609
+ ```
1610
+
1611
+ #### Show the Full Address Before Sending
1612
+
1613
+ Look-alike addresses can match the first and last four characters of a real one. Set `truncate={false}` on a payment review so every character shows, and ask people to check it against its source.
1614
+
1615
+ **Do:** Show every character of the recipient on review.
1616
+
1617
+ ```tsx
1618
+ /**
1619
+ * Do example for "Show the Full Address Before Sending" on the Hex page.
1620
+ * Show every character of the recipient on review.
1621
+ * @module
1622
+ */
1623
+ import { Hex, style } from '@tempoxyz/ds'
1624
+
1625
+ /** Renders the static preview, which the guideline card shows inert. */
1626
+ export function Demo() {
1627
+ return (
1628
+ <div {...styles.field()}>
1629
+ <span {...styles.label()}>Recipient</span>
1630
+ <Hex
1631
+ copy
1632
+ truncate={false}
1633
+ value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc"
1634
+ variant="filled"
1635
+ />
1636
+ </div>
1637
+ )
1638
+ }
1639
+
1640
+ namespace styles {
1641
+ export const field = style({ display: 'grid', gap: '4', width: '100% !custom' })
1642
+
1643
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
1644
+ }
1645
+ ```
1646
+
1647
+ **Don't:** Truncate the address people confirm a payment to.
1648
+
1649
+ ```tsx
1650
+ /**
1651
+ * Don't example for "Show the Full Address Before Sending" on the Hex page.
1652
+ * Don't truncate the address people confirm a payment to.
1653
+ * @module
1654
+ */
1655
+ import { Hex, style } from '@tempoxyz/ds'
1656
+
1657
+ /** Renders the static preview, which the guideline card shows inert. */
1658
+ export function Demo() {
1659
+ return (
1660
+ <div {...styles.field()}>
1661
+ <span {...styles.label()}>Recipient</span>
1662
+ <Hex copy value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" variant="filled" />
1663
+ </div>
1664
+ )
1665
+ }
1666
+
1667
+ namespace styles {
1668
+ export const field = style({
1669
+ display: 'grid',
1670
+ gap: '4',
1671
+ maxWidth: '100% !custom',
1672
+ width: '12rem !custom',
1673
+ })
1674
+
1675
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
1676
+ }
1677
+ ```
1678
+
1679
+ #### Label Every Value
1680
+
1681
+ **Do:** Put a label beside each value, such as Recipient or Transaction hash.
1682
+
1683
+ ```tsx
1684
+ /**
1685
+ * Do example for "Label Every Value" on the Hex page.
1686
+ * Put a label beside each value, such as Recipient or Transaction hash.
1687
+ * @module
1688
+ */
1689
+ import { Hex, style } from '@tempoxyz/ds'
1690
+
1691
+ /** Renders the static preview, which the guideline card shows inert. */
1692
+ export function Demo() {
1693
+ return (
1694
+ <div {...styles.list()}>
1695
+ <div {...styles.row()}>
1696
+ <span {...styles.label()}>Recipient</span>
1697
+ <Hex size="small" value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" />
1698
+ </div>
1699
+ <div {...styles.row()}>
1700
+ <span {...styles.label()}>Transaction hash</span>
1701
+ <Hex
1702
+ size="small"
1703
+ value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"
1704
+ />
1705
+ </div>
1706
+ </div>
1707
+ )
1708
+ }
1709
+
1710
+ namespace styles {
1711
+ export const label = style({
1712
+ color: 'content.secondary',
1713
+ flexShrink: '0 !custom',
1714
+ typography: 'body.b2',
1715
+ })
1716
+
1717
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
1718
+
1719
+ export const row = style({
1720
+ alignItems: 'baseline',
1721
+ display: 'flex',
1722
+ gap: '16',
1723
+ justifyContent: 'space-between',
1724
+ minWidth: '0',
1725
+ })
1726
+ }
1727
+ ```
1728
+
1729
+ **Don't:** Show bare hex strings. They don't identify themselves.
1730
+
1731
+ ```tsx
1732
+ /**
1733
+ * Don't example for "Label Every Value" on the Hex page.
1734
+ * Don't show bare hex strings. They don't identify themselves.
1735
+ * @module
1736
+ */
1737
+ import { Hex, style } from '@tempoxyz/ds'
1738
+
1739
+ /** Renders the static preview, which the guideline card shows inert. */
1740
+ export function Demo() {
1741
+ return (
1742
+ <div {...styles.list()}>
1743
+ <Hex size="small" value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" />
1744
+ <Hex
1745
+ size="small"
1746
+ value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"
1747
+ />
1748
+ </div>
1749
+ )
1750
+ }
1751
+
1752
+ namespace styles {
1753
+ export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
1754
+ }
1755
+ ```
1756
+
1757
+ #### Pick a Variant
1758
+
1759
+ * **Inline (inline):** The default, for text, rows, and table cells.
1760
+ * **Filled (filled):** A tinted field that copies on click, for standalone values.
1761
+ * **No Prefix (evm={false}):** For hex values without a `0x` prefix.
1762
+ * **Full Value (truncate={false}):** Every character, wrapped, for values people check.
1763
+
1764
+ ### Accessibility
1765
+
1766
+ Hex renders a `<span>` with the truncated value on screen and the full value for screen readers. With `copy`, the copy button follows the [WAI-ARIA Authoring Practices button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/).
1767
+
1768
+ #### Semantics
1769
+
1770
+ * **Truncated Text (aria-hidden):** Hidden. Screen readers read the full value from hidden text.
1771
+ * **Short Values:** Values that fit render as plain text, with no hidden copy of the value.
1772
+ * **Full Value (truncate={false}):** Every character renders as plain text, with no hidden copy.
1773
+ * **Hex.Copy (button):** Named "Copy" and the value, or `aria-label`. A copy renames it "Copied" for two seconds and announces it.
1774
+ * **Filled Variant (filled):** A click anywhere on the row copies. The button stays the keyboard path.
1775
+
1776
+ #### Keyboard
1777
+
1778
+ * **Move to Copy (Tab):** Moves focus to the copy button. The value takes no focus.
1779
+ * **Copy the Value (Enter or Space):** Copies the full value. Focus stays on the button.
1780
+
1781
+ #### Your Responsibilities
1782
+
1783
+ * **Name the Copy Button (aria-label):** Name what it copies, such as "Copy address". The default name reads the full value.
1784
+ * **Show a Name:** If a name or contact label exists, show it with the address. A raw hex string is hard to listen to.
1785
+
1786
+ ### Related
1787
+
1788
+ [CopyButton](actions.md#copybutton)
1789
+
1790
+ Use for copying without a visible value.
1791
+
1792
+ [Identicon](#identicon)
1793
+
1794
+ Use for an image beside an address.
1795
+
1796
+ [SecretValue](#secretvalue)
1797
+
1798
+ Use for secrets.
1799
+
1800
+ [Snippet](data-display.md#snippet)
1801
+
1802
+ Use for commands and URLs.
1803
+
1804
+ [Blockchain Values](../patterns.md#blockchain-values)
1805
+
1806
+ Covers addresses, hashes, and amounts.
1807
+
1808
+ ### Examples
1809
+
1810
+ #### Basic
1811
+
1812
+ ```tsx
1813
+ import { Hex, style } from '@tempoxyz/ds'
1814
+
1815
+ export function Demo() {
1816
+ return (
1817
+ <div {...styles.stack()}>
1818
+ <Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
1819
+ <Hex value="0x1234" />
1820
+ <div {...styles.frame()}>
1821
+ <Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
1822
+ </div>
1823
+ </div>
1824
+ )
1825
+ }
1826
+
1827
+ namespace styles {
1828
+ export const frame = style({
1829
+ borderColor: 'line.secondary',
1830
+ borderRadius: '2xs',
1831
+ borderStyle: 'dashed',
1832
+ borderWidth: 'regular',
1833
+ boxSizing: 'border-box',
1834
+ maxWidth: '100% !custom',
1835
+ padding: '8',
1836
+ width: '6rem !custom',
1837
+ })
1838
+
1839
+ export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
1840
+ }
1841
+ ```
1842
+
1843
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Basic.tsx)
1844
+
1845
+ #### Copy
1846
+
1847
+ Set `copy` to add a button that copies the full value.
1848
+
1849
+ ```tsx
1850
+ import { CopyButton, Hex, style } from '@tempoxyz/ds'
1851
+
1852
+ const address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
1853
+ const transaction = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'
1854
+
1855
+ export function Demo() {
1856
+ return (
1857
+ <div {...styles.stack()}>
1858
+ <Hex copy value={transaction} />
1859
+ {(['32rem', '20rem', '12rem', '8rem'] as const).map((width) => (
1860
+ <div key={width} {...styles.frame({ style: { width } })}>
1861
+ <Hex copy value={transaction} />
1862
+ </div>
1863
+ ))}
1864
+ <div {...styles.row()}>
1865
+ <CopyButton value={address} />
1866
+ <CopyButton value={address} variant="secondary" />
1867
+ <CopyButton size="large" value={address} variant="primary" />
1868
+ </div>
1869
+ </div>
1870
+ )
1871
+ }
1872
+
1873
+ namespace styles {
1874
+ export const frame = style({
1875
+ borderColor: 'line.secondary',
1876
+ borderRadius: '2xs',
1877
+ borderStyle: 'dashed',
1878
+ borderWidth: 'regular',
1879
+ boxSizing: 'border-box',
1880
+ maxWidth: '100% !custom',
1881
+ padding: '8',
1882
+ })
1883
+
1884
+ export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '12' })
1885
+
1886
+ export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
1887
+ }
1888
+ ```
1889
+
1890
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Copy.tsx)
1891
+
1892
+ #### Truncate
1893
+
1894
+ Set `truncate={false}` to show every character and wrap the value across lines. A filled row grows from its height and copies only from its button, so people can select the value.
1895
+
1896
+ ```tsx
1897
+ /**
1898
+ * Hex demo for the Truncate example: full values that wrap beside their copy buttons.
1899
+ * @module
1900
+ */
1901
+ import { Hex, style } from '@tempoxyz/ds'
1902
+
1903
+ const address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
1904
+ const transaction = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'
1905
+
1906
+ /** Renders an inline and a filled Hex that show every character. */
1907
+ export function Demo() {
1908
+ return (
1909
+ <div {...styles.stack()}>
1910
+ <Hex copy truncate={false} value={transaction} />
1911
+ <Hex copy truncate={false} value={address} variant="filled" />
1912
+ </div>
1913
+ )
1914
+ }
1915
+
1916
+ namespace styles {
1917
+ export const stack = style({
1918
+ display: 'grid',
1919
+ gap: '12',
1920
+ justifyItems: 'start',
1921
+ maxWidth: '100% !custom',
1922
+ width: '16rem !custom',
1923
+ })
1924
+ }
1925
+ ```
1926
+
1927
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Truncate.tsx)
1928
+
1929
+ #### Evm
1930
+
1931
+ Set `evm={false}` for values without a `0x` prefix.
1932
+
1933
+ ```tsx
1934
+ import { Hex } from '@tempoxyz/ds'
1935
+
1936
+ export function Demo() {
1937
+ return <Hex evm={false} value="a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718" />
1938
+ }
1939
+ ```
1940
+
1941
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Evm.tsx)
1942
+
1943
+ #### Variant
1944
+
1945
+ Set `variant` to `inline` (default) or `filled`.
1946
+
1947
+ ```tsx
1948
+ import { Hex, style } from '@tempoxyz/ds'
1949
+
1950
+ const transaction = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'
1951
+
1952
+ export function Demo() {
1953
+ return (
1954
+ <div {...styles.stack()}>
1955
+ <Hex copy value={transaction} variant="inline" />
1956
+ <div {...styles.resizable()}>
1957
+ <Hex copy value={transaction} variant="filled" />
1958
+ </div>
1959
+ </div>
1960
+ )
1961
+ }
1962
+
1963
+ namespace styles {
1964
+ export const resizable = style({
1965
+ maxWidth: '100% !custom',
1966
+ minWidth: 'min(10rem, 100%) !custom',
1967
+ overflow: 'hidden',
1968
+ resize: 'horizontal !custom',
1969
+ width: '28rem !custom',
1970
+ })
1971
+
1972
+ export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
1973
+ }
1974
+ ```
1975
+
1976
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Variant.tsx)
1977
+
1978
+ #### Size
1979
+
1980
+ Set `size` to `small`, `medium` (default), or `large`.
1981
+
1982
+ ```tsx
1983
+ import { Hex, style } from '@tempoxyz/ds'
1984
+
1985
+ export function Demo() {
1986
+ return (
1987
+ <div {...styles.stack()}>
1988
+ {(['small', 'medium', 'large'] as const).map((size) => (
1989
+ <Hex
1990
+ copy
1991
+ key={size}
1992
+ size={size}
1993
+ value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
1994
+ variant="filled"
1995
+ />
1996
+ ))}
1997
+ </div>
1998
+ )
1999
+ }
2000
+
2001
+ namespace styles {
2002
+ export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
2003
+ }
2004
+ ```
2005
+
2006
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Size.tsx)
2007
+
2008
+ ## Identicon
2009
+
2010
+ Shows a unique gradient avatar derived from an address.
2011
+
2012
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Identicon.tsx)
2013
+
2014
+ ### Overview
2015
+
2016
+ An identicon is a round gradient avatar derived from an address. The same address always renders the same colors.
2017
+
2018
+ ### Anatomy
2019
+
2020
+ Import the component and assemble its parts.
2021
+
2022
+ ```tsx
2023
+ import { Identicon } from '@tempoxyz/ds'
2024
+
2025
+ <Identicon />
2026
+ ```
2027
+
2028
+ ### Guidelines
2029
+
2030
+ #### When to Use
2031
+
2032
+ * Give an address an image beside its text, in recipient lists, activity rows, and account switchers.
2033
+ * Fill an `Avatar.Fallback` for an account known only by its address.
2034
+
2035
+ #### When Not to Use
2036
+
2037
+ * Use [Avatar](data-display.md#avatar) for people and organizations with a name.
2038
+ * Use [TokenLogo](#tokenlogo) for a token contract, which has its own icon.
2039
+ * Use [Hex](#hex) to read, compare, or copy the address.
2040
+
2041
+ #### Always Show the Address Beside It
2042
+
2043
+ Colors come from seven hue palettes, so addresses often look alike. Color alone doesn't identify an account ([SC 1.4.1](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)).
2044
+
2045
+ **Do:** Place the address, with `copy`, or the account name beside each identicon.
2046
+
2047
+ ```tsx
2048
+ /**
2049
+ * Do example for "Always Show the Address Beside It" on the Identicon page.
2050
+ * Place the address, with `copy`, or the account name beside each identicon.
2051
+ * @module
2052
+ */
2053
+ import { Hex, Identicon, style } from '@tempoxyz/ds'
2054
+
2055
+ const addresses = [
2056
+ '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
2057
+ '0x71C7656EC7ab88b098defB751B7401B5f6d8976F',
2058
+ ] as const
2059
+
2060
+ /** Renders the static preview, which the guideline card shows inert. */
2061
+ export function Demo() {
2062
+ return (
2063
+ <div {...styles.list()}>
2064
+ {addresses.map((address) => (
2065
+ <div key={address} {...styles.row()}>
2066
+ <Identicon address={address} aria-hidden size="32" />
2067
+ <Hex copy value={address} />
2068
+ </div>
2069
+ ))}
2070
+ </div>
2071
+ )
2072
+ }
2073
+
2074
+ namespace styles {
2075
+ export const list = style({ display: 'grid', gap: '12', minWidth: '0' })
2076
+
2077
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12', minWidth: '0' })
2078
+ }
2079
+ ```
2080
+
2081
+ **Don't:** Show identicons without the address or name they stand for.
2082
+
2083
+ ```tsx
2084
+ /**
2085
+ * Don't example for "Always Show the Address Beside It" on the Identicon page.
2086
+ * Don't show identicons without the address or name they stand for.
2087
+ * @module
2088
+ */
2089
+ import { Identicon, style } from '@tempoxyz/ds'
2090
+
2091
+ const addresses = [
2092
+ '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
2093
+ '0x71C7656EC7ab88b098defB751B7401B5f6d8976F',
2094
+ '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
2095
+ ] as const
2096
+
2097
+ /** Renders the static preview, which the guideline card shows inert. */
2098
+ export function Demo() {
2099
+ return (
2100
+ <div {...styles.row()}>
2101
+ {addresses.map((address) => (
2102
+ <Identicon address={address} key={address} size="32" />
2103
+ ))}
2104
+ </div>
2105
+ )
2106
+ }
2107
+
2108
+ namespace styles {
2109
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2110
+ }
2111
+ ```
2112
+
2113
+ #### Don't Treat It as Verification
2114
+
2115
+ An identicon doesn't prove an address is correct. Before a send, show the full address on the review step.
2116
+
2117
+ **Do:** Ask people to compare characters.
2118
+
2119
+ ```tsx
2120
+ /**
2121
+ * Do example for "Don't Treat It as Verification" on the Identicon page.
2122
+ * Ask people to compare characters.
2123
+ * @module
2124
+ */
2125
+ import { Hex, Identicon, style } from '@tempoxyz/ds'
2126
+
2127
+ const address = '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc'
2128
+
2129
+ /** Renders the static preview, which the guideline card shows inert. */
2130
+ export function Demo() {
2131
+ return (
2132
+ <div {...styles.field()}>
2133
+ <span {...styles.label()}>Recipient</span>
2134
+ <div {...styles.row()}>
2135
+ <Identicon address={address} aria-hidden size="24" />
2136
+ <Hex size="small" value={address} />
2137
+ </div>
2138
+ <span {...styles.hint()}>Compare every character with the address you copied.</span>
2139
+ </div>
2140
+ )
2141
+ }
2142
+
2143
+ namespace styles {
2144
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
2145
+
2146
+ export const hint = style({ color: 'content.secondary', typography: 'body.b3' })
2147
+
2148
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
2149
+
2150
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '8', minWidth: '0' })
2151
+ }
2152
+ ```
2153
+
2154
+ **Don't:** Ask people to compare colors.
2155
+
2156
+ ```tsx
2157
+ /**
2158
+ * Don't example for "Don't Treat It as Verification" on the Identicon page.
2159
+ * Don't ask people to compare colors.
2160
+ * @module
2161
+ */
2162
+ import { Hex, Identicon, style } from '@tempoxyz/ds'
2163
+
2164
+ const address = '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc'
2165
+
2166
+ /** Renders the static preview, which the guideline card shows inert. */
2167
+ export function Demo() {
2168
+ return (
2169
+ <div {...styles.field()}>
2170
+ <span {...styles.label()}>Recipient</span>
2171
+ <div {...styles.row()}>
2172
+ <Identicon address={address} aria-hidden size="24" />
2173
+ <Hex size="small" value={address} />
2174
+ </div>
2175
+ <span {...styles.hint()}>Make sure the colors match your contact.</span>
2176
+ </div>
2177
+ )
2178
+ }
2179
+
2180
+ namespace styles {
2181
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
2182
+
2183
+ export const hint = style({ color: 'content.secondary', typography: 'body.b3' })
2184
+
2185
+ export const label = style({ color: 'content.secondary', typography: 'body.b2' })
2186
+
2187
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '8', minWidth: '0' })
2188
+ }
2189
+ ```
2190
+
2191
+ #### Derive It From the Address
2192
+
2193
+ Letter case doesn't change the colors, so checksummed and lowercase forms match.
2194
+
2195
+ **Do:** Pass the address, so a rename keeps the same image.
2196
+
2197
+ ```tsx
2198
+ /**
2199
+ * Do example for "Derive It From the Address" on the Identicon page.
2200
+ * Pass the address, so a rename keeps the same image.
2201
+ * @module
2202
+ */
2203
+ import { Identicon, style } from '@tempoxyz/ds'
2204
+
2205
+ const address = '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc'
2206
+
2207
+ /** Renders the static preview, which the guideline card shows inert. */
2208
+ export function Demo() {
2209
+ return (
2210
+ <div {...styles.list()}>
2211
+ <div {...styles.row()}>
2212
+ <Identicon address={address} aria-hidden size="32" />
2213
+ <span {...styles.name()}>Alice</span>
2214
+ </div>
2215
+ <div {...styles.row()}>
2216
+ <Identicon address={address} aria-hidden size="32" />
2217
+ <span {...styles.name()}>Alice Chen</span>
2218
+ </div>
2219
+ </div>
2220
+ )
2221
+ }
2222
+
2223
+ namespace styles {
2224
+ export const list = style({ display: 'grid', gap: '12' })
2225
+
2226
+ export const name = style({ color: 'content.primary', typography: 'body.b2' })
2227
+
2228
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2229
+ }
2230
+ ```
2231
+
2232
+ **Don't:** Pass a display name. The image changes when the name does.
2233
+
2234
+ ```tsx
2235
+ /**
2236
+ * Don't example for "Derive It From the Address" on the Identicon page.
2237
+ * Don't pass a display name. The image changes when the name does.
2238
+ * @module
2239
+ */
2240
+ import { Identicon, style } from '@tempoxyz/ds'
2241
+
2242
+ /** Renders the static preview, which the guideline card shows inert. */
2243
+ export function Demo() {
2244
+ return (
2245
+ <div {...styles.list()}>
2246
+ <div {...styles.row()}>
2247
+ <Identicon address="Alice" aria-hidden size="32" />
2248
+ <span {...styles.name()}>Alice</span>
2249
+ </div>
2250
+ <div {...styles.row()}>
2251
+ <Identicon address="Alice Chen" aria-hidden size="32" />
2252
+ <span {...styles.name()}>Alice Chen</span>
2253
+ </div>
2254
+ </div>
2255
+ )
2256
+ }
2257
+
2258
+ namespace styles {
2259
+ export const list = style({ display: 'grid', gap: '12' })
2260
+
2261
+ export const name = style({ color: 'content.primary', typography: 'body.b2' })
2262
+
2263
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2264
+ }
2265
+ ```
2266
+
2267
+ #### Size It With the Text Beside It
2268
+
2269
+ * **Inline (16):** Inline with body text.
2270
+ * **Dense Rows (24 or 32):** In dense rows and tables.
2271
+ * **List Rows (40):** The default, in list rows.
2272
+ * **Account Headers (48 or 64):** In account headers.
2273
+ * **Fill a Frame (fill):** Inside an avatar fallback or other sized frame.
2274
+
2275
+ ### Accessibility
2276
+
2277
+ An identicon renders an `<svg>` with the `img` role. It takes no focus.
2278
+
2279
+ #### Semantics
2280
+
2281
+ * **Root (img):** Announced as an image by name.
2282
+ * **Name (aria-label):** Defaults to the full address, all 42 characters.
2283
+
2284
+ #### Your Responsibilities
2285
+
2286
+ * **Hide a Duplicate (aria-hidden):** If the address is in nearby text, hide the identicon so it isn't announced twice.
2287
+ * **Name a Standalone Identicon (aria-label):** If it stands alone, name the account, such as "Savings account".
2288
+
2289
+ ### Related
2290
+
2291
+ [Avatar](data-display.md#avatar)
2292
+
2293
+ Use for people and organizations.
2294
+
2295
+ [Hex](#hex)
2296
+
2297
+ Use for showing and copying addresses.
2298
+
2299
+ [TokenLogo](#tokenlogo)
2300
+
2301
+ Use for token icons.
2302
+
2303
+ [Blockchain Values](../patterns.md#blockchain-values)
2304
+
2305
+ Covers displaying addresses.
2306
+
2307
+ ### Examples
2308
+
2309
+ #### Basic
2310
+
2311
+ ```tsx
2312
+ import { Identicon } from '@tempoxyz/ds'
2313
+
2314
+ export function Demo() {
2315
+ return <Identicon address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
2316
+ }
2317
+ ```
2318
+
2319
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Identicon/Basic.tsx)
2320
+
2321
+ #### Size
2322
+
2323
+ Set `size` to `16`, `24`, `32`, `40` (default), `48`, or `64` pixels.
2324
+
2325
+ ```tsx
2326
+ import { Identicon, style } from '@tempoxyz/ds'
2327
+
2328
+ export function Demo() {
2329
+ return (
2330
+ <div {...styles.row()}>
2331
+ {(['16', '24', '32', '40', '48', '64'] as const).map((size) => (
2332
+ <Identicon address="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" key={size} size={size} />
2333
+ ))}
2334
+ </div>
2335
+ )
2336
+ }
2337
+
2338
+ namespace styles {
2339
+ export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '12' })
2340
+ }
2341
+ ```
2342
+
2343
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Identicon/Size.tsx)
2344
+
2345
+ #### Address
2346
+
2347
+ Each `address` derives its own colors.
2348
+
2349
+ ```tsx
2350
+ import { Identicon, style } from '@tempoxyz/ds'
2351
+
2352
+ const addresses = [
2353
+ '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
2354
+ '0x71C7656EC7ab88b098defB751B7401B5f6d8976F',
2355
+ '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
2356
+ '0x0000000000000000000000000000000000000000',
2357
+ '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
2358
+ '0x6B175474E89094C44Da98b954EedeAC495271d0F',
2359
+ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
2360
+ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
2361
+ ]
2362
+
2363
+ export function Demo() {
2364
+ return (
2365
+ <div {...styles.row()}>
2366
+ {addresses.map((address) => (
2367
+ <Identicon address={address} key={address} size="64" />
2368
+ ))}
2369
+ </div>
2370
+ )
2371
+ }
2372
+
2373
+ namespace styles {
2374
+ export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '12' })
2375
+ }
2376
+ ```
2377
+
2378
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Identicon/Address.tsx)
2379
+
2380
+ ## NetworkLogo
2381
+
2382
+ Shows the logo of the network a token lives on.
2383
+
2384
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/NetworkLogo.tsx)
2385
+
2386
+ ### Overview
2387
+
2388
+ A network logo renders a network's artwork as an inline SVG, cropped to a circle. The artwork keeps the network's brand colors in both color schemes.
2389
+
2390
+ ### Anatomy
2391
+
2392
+ Import the component and assemble its parts.
2393
+
2394
+ ```tsx
2395
+ import { NetworkLogo } from '@tempoxyz/ds'
2396
+
2397
+ <NetworkLogo />
2398
+ ```
2399
+
2400
+ ### Guidelines
2401
+
2402
+ #### When to Use
2403
+
2404
+ * Show which network a token, an address, or a deposit belongs to, such as in a Receive flow or a network picker.
2405
+
2406
+ #### When Not to Use
2407
+
2408
+ * Use [TokenLogo](#tokenlogo) for the token itself.
2409
+ * Use [Identicon](#identicon) for an account address.
2410
+ * Use [IconTile](data-display.md#icontile) for a feature or category icon.
2411
+
2412
+ #### Name the Network
2413
+
2414
+ Many people don't know every network's logo.
2415
+
2416
+ **Do:** Show the network name beside each logo.
2417
+
2418
+ ```tsx
2419
+ /**
2420
+ * Do example for "Name the Network" on the NetworkLogo page.
2421
+ * Show the network name beside each logo.
2422
+ * @module
2423
+ */
2424
+ import { NetworkLogo, style } from '@tempoxyz/ds'
2425
+
2426
+ const networks = [
2427
+ ['tempo', 'Tempo'],
2428
+ ['base', 'Base'],
2429
+ ['ethereum', 'Ethereum'],
2430
+ ] as const
2431
+
2432
+ /** Renders the static preview, which the guideline card shows inert. */
2433
+ export function Demo() {
2434
+ return (
2435
+ <div {...styles.list()}>
2436
+ {networks.map(([network, label]) => (
2437
+ <div key={network} {...styles.row()}>
2438
+ <NetworkLogo network={network} size="large" />
2439
+ <span {...styles.name()}>{label}</span>
2440
+ </div>
2441
+ ))}
2442
+ </div>
2443
+ )
2444
+ }
2445
+
2446
+ namespace styles {
2447
+ export const list = style({ display: 'grid', gap: '12' })
2448
+
2449
+ export const name = style({ color: 'content.primary', typography: 'body.b2Strong' })
2450
+
2451
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2452
+ }
2453
+ ```
2454
+
2455
+ **Don't:** Ask people to tell networks apart by logo alone.
2456
+
2457
+ ```tsx
2458
+ /**
2459
+ * Don't example for "Name the Network" on the NetworkLogo page.
2460
+ * Logos alone ask people to recognize every network's brand.
2461
+ * @module
2462
+ */
2463
+ import { NetworkLogo, style } from '@tempoxyz/ds'
2464
+
2465
+ /** Renders the static preview, which the guideline card shows inert. */
2466
+ export function Demo() {
2467
+ return (
2468
+ <div {...styles.row()}>
2469
+ <NetworkLogo network="tempo" size="large" />
2470
+ <NetworkLogo network="base" size="large" />
2471
+ <NetworkLogo network="ethereum" size="large" />
2472
+ </div>
2473
+ )
2474
+ }
2475
+
2476
+ namespace styles {
2477
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2478
+ }
2479
+ ```
2480
+
2481
+ #### Match Size to the Context
2482
+
2483
+ * **Medium (20px):** Beside a network name in a value or chip.
2484
+ * **Large (32px):** In network rows and network pickers.
2485
+
2486
+ #### Keep the Brand Artwork
2487
+
2488
+ **Do:** Use the logo as it renders, in its own colors.
2489
+
2490
+ ```tsx
2491
+ <NetworkLogo network="ethereum" size="large" />
2492
+ ```
2493
+
2494
+ **Don't:** Recolor the logo, or redraw it as a colored circle with a letter.
2495
+
2496
+ ```tsx
2497
+ <span
2498
+ style={{
2499
+ alignItems: 'center',
2500
+ background: '#627eea',
2501
+ borderRadius: 999,
2502
+ color: 'white',
2503
+ display: 'inline-flex',
2504
+ font: '600 14px Inter',
2505
+ height: 32,
2506
+ justifyContent: 'center',
2507
+ width: 32,
2508
+ }}
2509
+ >
2510
+ E
2511
+ </span>
2512
+ ```
2513
+
2514
+ ### Accessibility
2515
+
2516
+ A network logo renders an `<svg>` that is hidden from screen readers by default. It is not interactive and takes no focus.
2517
+
2518
+ #### Semantics
2519
+
2520
+ * **Root (aria-hidden):** Hidden from screen readers, so the visible name beside it is read once.
2521
+ * **Named Logo (aria-label):** An `aria-label` gives the logo the `img` role, so screen readers announce it.
2522
+
2523
+ #### Your Responsibilities
2524
+
2525
+ * **Name a Standalone Logo (aria-label):** If no visible text names the network, pass the network name as `aria-label`.
2526
+
2527
+ ### Related
2528
+
2529
+ [TokenLogo](#tokenlogo)
2530
+
2531
+ Use for token logos.
2532
+
2533
+ [AssetChip](#assetchip)
2534
+
2535
+ Use for listing the assets a network supports.
2536
+
2537
+ [ListGroup](data-display.md#listgroup)
2538
+
2539
+ Use for network lists.
2540
+
2541
+ [Blockchain Values](../patterns.md#blockchain-values)
2542
+
2543
+ Covers tokens, networks, and addresses.
2544
+
2545
+ ### Examples
2546
+
2547
+ #### Basic
2548
+
2549
+ ```tsx
2550
+ import { NetworkLogo, style } from '@tempoxyz/ds'
2551
+
2552
+ export function Demo() {
2553
+ return (
2554
+ <div {...styles.row()}>
2555
+ <NetworkLogo network="tempo" />
2556
+ Tempo
2557
+ </div>
2558
+ )
2559
+ }
2560
+
2561
+ namespace styles {
2562
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '8' })
2563
+ }
2564
+ ```
2565
+
2566
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/NetworkLogo/Basic.tsx)
2567
+
2568
+ #### Network
2569
+
2570
+ Set `network` to `base`, `ethereum`, `hyperevm`, `polygon`, `solana`, or `tempo`.
2571
+
2572
+ ```tsx
2573
+ import { NetworkLogo, style } from '@tempoxyz/ds'
2574
+
2575
+ const networks = [
2576
+ ['base', 'Base'],
2577
+ ['ethereum', 'Ethereum'],
2578
+ ['hyperevm', 'HyperEVM'],
2579
+ ['polygon', 'Polygon'],
2580
+ ['solana', 'Solana'],
2581
+ ['tempo', 'Tempo'],
2582
+ ] as const
2583
+
2584
+ export function Demo() {
2585
+ return (
2586
+ <div {...styles.grid()}>
2587
+ {networks.map(([network, label]) => (
2588
+ <div key={network} {...styles.row()}>
2589
+ <NetworkLogo network={network} />
2590
+ {label}
2591
+ </div>
2592
+ ))}
2593
+ </div>
2594
+ )
2595
+ }
2596
+
2597
+ namespace styles {
2598
+ export const grid = style({ display: 'grid', gap: '12' })
2599
+
2600
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '8' })
2601
+ }
2602
+ ```
2603
+
2604
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/NetworkLogo/Network.tsx)
2605
+
2606
+ #### Size
2607
+
2608
+ Set `size` to `medium` (20px, default) or `large` (32px).
2609
+
2610
+ ```tsx
2611
+ import { NetworkLogo, style } from '@tempoxyz/ds'
2612
+
2613
+ export function Demo() {
2614
+ return (
2615
+ <div {...styles.row()}>
2616
+ <NetworkLogo network="ethereum" size="medium" />
2617
+ <NetworkLogo network="ethereum" size="large" />
2618
+ </div>
2619
+ )
2620
+ }
2621
+
2622
+ namespace styles {
2623
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
2624
+ }
2625
+ ```
2626
+
2627
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/NetworkLogo/Size.tsx)
2628
+
2629
+ ## Qr
2630
+
2631
+ Renders a value as a QR code.
2632
+
2633
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Qr.tsx)
2634
+
2635
+ ### Overview
2636
+
2637
+ Qr renders a value as a QR code in the foreground color on a transparent ground.
2638
+
2639
+ ### Anatomy
2640
+
2641
+ Import the component and assemble its parts.
2642
+
2643
+ ```tsx
2644
+ import { Qr } from '@tempoxyz/ds'
2645
+
2646
+ <Qr />
2647
+ ```
2648
+
2649
+ ### Guidelines
2650
+
2651
+ #### When to Use
2652
+
2653
+ * Show a deposit address in a receive flow, for a scan from another wallet.
2654
+ * Move a link from a computer to a phone, such as a payment request.
2655
+
2656
+ #### When Not to Use
2657
+
2658
+ * Use a link or `Button.Link` ([Button](actions.md#button)) for a URL opened on the same device.
2659
+ * Use [Hex](#hex) with `copy` alone when the reader needs the value on the same device. A phone cannot scan its own screen.
2660
+
2661
+ #### Show the Address as Text Too
2662
+
2663
+ Many people cannot scan: someone on the same phone, a screen reader user, or someone without a camera.
2664
+
2665
+ * **Copy:** Put the address beside the code with [Hex](#hex) and `copy`.
2666
+ * **Match:** The text must match what the code encodes. If the code holds a URI, such as `tempo:` and the address, show the same address. Never encode a different value, such as a tracking link.
2667
+ * **Network:** A code does not show its network. State what the address accepts, such as Send USDC on Tempo to this address.
2668
+
2669
+ **Do:** Show the address with a copy button, and the network it accepts, beside the code.
2670
+
2671
+ ```tsx
2672
+ /**
2673
+ * Do example for "Show the Address as Text Too" on the Qr page.
2674
+ * Show the address with a copy button, and the network it accepts, beside the code.
2675
+ * @module
2676
+ */
2677
+ import { Hex, Qr, style } from '@tempoxyz/ds'
2678
+
2679
+ const address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
2680
+
2681
+ /** Renders the static preview, which the guideline card shows inert. */
2682
+ export function Demo() {
2683
+ return (
2684
+ <div {...styles.stack()}>
2685
+ <Qr aria-label="Deposit address QR code" size="small" value={address} />
2686
+ <span {...styles.note()}>Send USDC on Tempo to this address</span>
2687
+ <Hex copy size="small" value={address} variant="filled" {...styles.hex()} />
2688
+ </div>
2689
+ )
2690
+ }
2691
+
2692
+ namespace styles {
2693
+ export const hex = style({ width: '100% !custom' })
2694
+
2695
+ export const note = style({
2696
+ color: 'content.secondary',
2697
+ textAlign: 'center',
2698
+ typography: 'body.b3',
2699
+ })
2700
+
2701
+ export const stack = style({
2702
+ display: 'grid',
2703
+ gap: '12',
2704
+ justifyItems: 'center',
2705
+ width: '100% !custom',
2706
+ })
2707
+ }
2708
+ ```
2709
+
2710
+ **Don't:** Show a code without the value it encodes.
2711
+
2712
+ ```tsx
2713
+ /**
2714
+ * Don't example for "Show the Address as Text Too" on the Qr page.
2715
+ * Don't show a code without the value it encodes.
2716
+ * @module
2717
+ */
2718
+ import { Qr } from '@tempoxyz/ds'
2719
+
2720
+ /** Renders the static preview, which the guideline card shows inert. */
2721
+ export function Demo() {
2722
+ return <Qr size="small" value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
2723
+ }
2724
+ ```
2725
+
2726
+ #### Keep Contrast and Clear Space
2727
+
2728
+ * **Dark mode:** The modules turn light on a dark ground, and some scanners cannot read inverted codes. If older scanners matter, use a light panel and set `color` to a dark value with 3:1 contrast in both schemes.
2729
+ * **Clear space:** Keep borders, text, and controls off the edges of the code.
2730
+
2731
+ **Do:** Place the code on a plain background with space around it.
2732
+
2733
+ ```tsx
2734
+ /**
2735
+ * Do example for "Keep Contrast and Clear Space" on the Qr page.
2736
+ * Place the code on a plain background with space around it.
2737
+ * @module
2738
+ */
2739
+ import { Qr, style } from '@tempoxyz/ds'
2740
+
2741
+ /** Renders the static preview, which the guideline card shows inert. */
2742
+ export function Demo() {
2743
+ return (
2744
+ <div {...styles.panel()}>
2745
+ <Qr
2746
+ aria-label="Deposit address QR code"
2747
+ size="small"
2748
+ value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
2749
+ />
2750
+ </div>
2751
+ )
2752
+ }
2753
+
2754
+ namespace styles {
2755
+ export const panel = style({
2756
+ backgroundColor: 'background.primary',
2757
+ borderRadius: 'sm',
2758
+ padding: '24',
2759
+ })
2760
+ }
2761
+ ```
2762
+
2763
+ **Don't:** Place the code over an image or gradient.
2764
+
2765
+ ```tsx
2766
+ /**
2767
+ * Don't example for "Keep Contrast and Clear Space" on the Qr page.
2768
+ * Don't place the code over an image or gradient.
2769
+ * @module
2770
+ */
2771
+ import { Qr, style } from '@tempoxyz/ds'
2772
+
2773
+ /** Renders the static preview, which the guideline card shows inert. */
2774
+ export function Demo() {
2775
+ return (
2776
+ <div {...styles.panel()}>
2777
+ <Qr
2778
+ aria-label="Deposit address QR code"
2779
+ size="small"
2780
+ value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
2781
+ />
2782
+ </div>
2783
+ )
2784
+ }
2785
+
2786
+ namespace styles {
2787
+ export const panel = style({
2788
+ backgroundImage: 'linear-gradient(135deg, #3b82f6, #a855f7 50%, #f97316) !custom',
2789
+ borderRadius: 'sm',
2790
+ padding: '4',
2791
+ })
2792
+ }
2793
+ ```
2794
+
2795
+ #### Use a Logo Only at Larger Sizes
2796
+
2797
+ `arena` draws a logo in the center and raises error correction to medium, so scanners recover the covered modules. Use the token's logo or Tempo's.
2798
+
2799
+ **Do:** Add a logo only to a `medium` or `large` code.
2800
+
2801
+ ```tsx
2802
+ /**
2803
+ * Do example for "Use a Logo Only at Larger Sizes" on the Qr page.
2804
+ * Add a logo only to a `medium` or `large` code.
2805
+ * @module
2806
+ */
2807
+ import { Qr } from '@tempoxyz/ds'
2808
+ import pathUsd from '../../coins/PathUSD.svg'
2809
+
2810
+ /** Renders the static preview, which the guideline card shows inert. */
2811
+ export function Demo() {
2812
+ return (
2813
+ <Qr
2814
+ arena={pathUsd}
2815
+ aria-label="Deposit address QR code"
2816
+ size="medium"
2817
+ value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
2818
+ />
2819
+ )
2820
+ }
2821
+ ```
2822
+
2823
+ **Don't:** Add a logo to a `small` code.
2824
+
2825
+ ```tsx
2826
+ /**
2827
+ * Don't example for "Use a Logo Only at Larger Sizes" on the Qr page.
2828
+ * Don't add a logo to a `small` code.
2829
+ * @module
2830
+ */
2831
+ import { Qr } from '@tempoxyz/ds'
2832
+ import pathUsd from '../../coins/PathUSD.svg'
2833
+
2834
+ /** Renders the static preview, which the guideline card shows inert. */
2835
+ export function Demo() {
2836
+ return (
2837
+ <Qr
2838
+ arena={pathUsd}
2839
+ aria-label="Deposit address QR code"
2840
+ size="small"
2841
+ value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
2842
+ />
2843
+ )
2844
+ }
2845
+ ```
2846
+
2847
+ #### Size for the Screen
2848
+
2849
+ * **Small (160px):** In a panel beside other content.
2850
+ * **Medium (240px):** The default, for a receive dialog.
2851
+ * **Large (320px):** The roomiest size, for a code with a logo.
2852
+
2853
+ ### Accessibility
2854
+
2855
+ Qr renders an `<svg>` with the `img` role. It is not interactive and takes no focus.
2856
+
2857
+ #### Semantics
2858
+
2859
+ * **Root (img):** An image that screen readers announce by its name.
2860
+ * **Name (aria-label):** Defaults to "QR code for" and the full value.
2861
+ * **Arena (Arena):** Set `arena` to an image URL to add a logo, announced as a nested image.
2862
+ * **Modules (foreground):** On a transparent ground, so the code follows the light or dark scheme.
2863
+
2864
+ #### Your Responsibilities
2865
+
2866
+ * **Name It by Purpose (aria-label):** Describe what it encodes, such as "Deposit address QR code".
2867
+ * **Name the Logo (arena):** Pass a node with its own accessible name, or make sure the logo's name adds no noise.
2868
+
2869
+ ### Related
2870
+
2871
+ [Hex](#hex)
2872
+
2873
+ Use for showing and copying the address.
2874
+
2875
+ [CopyButton](actions.md#copybutton)
2876
+
2877
+ Use for copying a value.
2878
+
2879
+ [Snippet](data-display.md#snippet)
2880
+
2881
+ Use for links and other values.
2882
+
2883
+ [Payments](../patterns.md#payments)
2884
+
2885
+ Covers send and receive flows.
2886
+
2887
+ [Tempo Wallet](../patterns.md#tempo-wallet)
2888
+
2889
+ Covers the receive screen.
2890
+
2891
+ ### Examples
2892
+
2893
+ #### Basic
2894
+
2895
+ ```tsx
2896
+ import { Qr } from '@tempoxyz/ds'
2897
+
2898
+ export function Demo() {
2899
+ return <Qr value="tempo:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
2900
+ }
2901
+ ```
2902
+
2903
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Qr/Basic.tsx)
2904
+
2905
+ #### Size
2906
+
2907
+ Set `size` to `small`, `medium` (default), or `large`.
2908
+
2909
+ ```tsx
2910
+ import { Qr, style } from '@tempoxyz/ds'
2911
+
2912
+ export function Demo() {
2913
+ return (
2914
+ <div {...styles.row()}>
2915
+ {(['small', 'medium', 'large'] as const).map((size) => (
2916
+ <Qr key={size} size={size} value="tempo:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
2917
+ ))}
2918
+ </div>
2919
+ )
2920
+ }
2921
+
2922
+ namespace styles {
2923
+ export const row = style({ alignItems: 'start', display: 'flex', flexWrap: 'wrap', gap: '16' })
2924
+ }
2925
+ ```
2926
+
2927
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Qr/Size.tsx)
2928
+
2929
+ #### Arena
2930
+
2931
+ Pass an image URL to `arena` to draw a logo in the center.
2932
+
2933
+ ```tsx
2934
+ import { Qr } from '@tempoxyz/ds'
2935
+ import pathUsd from '../../coins/PathUSD.svg'
2936
+
2937
+ export function Demo() {
2938
+ return <Qr arena={pathUsd} value="https://example.org" />
2939
+ }
2940
+ ```
2941
+
2942
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Qr/Arena.tsx)
2943
+
2944
+ ## SecretValue
2945
+
2946
+ Masks a secret and adds reveal and copy buttons.
2947
+
2948
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/SecretValue.tsx)
2949
+
2950
+ ### Overview
2951
+
2952
+ SecretValue masks a secret behind 16 dots and adds reveal and copy buttons. A click anywhere on the block copies the value without revealing it.
2953
+
2954
+ ### Anatomy
2955
+
2956
+ Import the component and assemble its parts.
2957
+
2958
+ ```tsx
2959
+ import { SecretValue } from '@tempoxyz/ds'
2960
+
2961
+ <SecretValue />
2962
+ ```
2963
+
2964
+ ### Guidelines
2965
+
2966
+ #### When to Use
2967
+
2968
+ * Show an API key, webhook signing secret, or access key that people copy into another system.
2969
+ * Show a recovery key that people must store, behind an explicit reveal.
2970
+
2971
+ #### When Not to Use
2972
+
2973
+ * Use [Snippet](data-display.md#snippet) for commands and values that are not secret, such as a webhook URL.
2974
+ * Use [Hex](#hex) with `copy` for public addresses and transaction hashes.
2975
+ * Use [TextInput](forms-and-inputs.md#textinput) with `type="password"` when people enter a secret.
2976
+
2977
+ #### Start Masked
2978
+
2979
+ Keep the value hidden until someone presses Reveal. Copy works without a reveal, and anyone near the screen or in a screen share can read a revealed value.
2980
+
2981
+ * **`defaultRevealed`:** Set it only on a screen that exists to show the value, such as a key creation confirmation.
2982
+ * **Mask again:** Control `revealed` with `onRevealedChange` to mask the value again, such as when the tab is hidden or after a minute.
2983
+
2984
+ **Do:** Show the secret masked, with its name above it.
2985
+
2986
+ ```tsx
2987
+ /** Do example for "Start Masked" on the SecretValue page: show the secret masked, with its name above it. @module */
2988
+ import { SecretValue, style } from '@tempoxyz/ds'
2989
+
2990
+ /** Renders the static preview, which the guideline card shows inert. */
2991
+ export function Demo() {
2992
+ return (
2993
+ <div {...styles.field()}>
2994
+ <span {...styles.label()}>Production API key</span>
2995
+ <SecretValue label="Production API key" value="tk_live_9fA2c81bE07d4c55a3e6" />
2996
+ </div>
2997
+ )
2998
+ }
2999
+
3000
+ namespace styles {
3001
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
3002
+
3003
+ export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
3004
+ }
3005
+ ```
3006
+
3007
+ **Don't:** Reveal a secret by default on a page people return to, such as a key list.
3008
+
3009
+ ```tsx
3010
+ /**
3011
+ * Don't example for "Start Masked" on the SecretValue page.
3012
+ * Don't reveal a secret by default on a page people return to, such as a key list.
3013
+ * @module
3014
+ */
3015
+ import { SecretValue, style } from '@tempoxyz/ds'
3016
+
3017
+ /** Renders the static preview, which the guideline card shows inert. */
3018
+ export function Demo() {
3019
+ return (
3020
+ <div {...styles.field()}>
3021
+ <span {...styles.label()}>Production API key</span>
3022
+ <SecretValue
3023
+ defaultRevealed
3024
+ label="Production API key"
3025
+ value="tk_live_9fA2c81bE07d4c55a3e6"
3026
+ />
3027
+ </div>
3028
+ )
3029
+ }
3030
+
3031
+ namespace styles {
3032
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
3033
+
3034
+ export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
3035
+ }
3036
+ ```
3037
+
3038
+ #### Name Every Secret
3039
+
3040
+ `label` sets the group's `aria-label`, which gives each button context. It is not visible. The mask is always 16 dots, so it can't tell keys apart either.
3041
+
3042
+ **Do:** Show what each key unlocks above it, with a creation or last used date.
3043
+
3044
+ ```tsx
3045
+ /**
3046
+ * Do example for "Name Every Secret" on the SecretValue page.
3047
+ * Show what each key unlocks above it, with a creation or last used date.
3048
+ * @module
3049
+ */
3050
+ import { SecretValue, style } from '@tempoxyz/ds'
3051
+
3052
+ /** Renders the static preview, which the guideline card shows inert. */
3053
+ export function Demo() {
3054
+ return (
3055
+ <div {...styles.list()}>
3056
+ <div {...styles.field()}>
3057
+ <div {...styles.header()}>
3058
+ <span {...styles.label()}>Production API key</span>
3059
+ <span {...styles.meta()}>Last used 2 hours ago</span>
3060
+ </div>
3061
+ <SecretValue label="Production API key" size="small" value="tk_live_9fA2c81bE07d4c55a3e6" />
3062
+ </div>
3063
+ <div {...styles.field()}>
3064
+ <div {...styles.header()}>
3065
+ <span {...styles.label()}>Staging API key</span>
3066
+ <span {...styles.meta()}>Created Oct 2</span>
3067
+ </div>
3068
+ <SecretValue label="Staging API key" size="small" value="tk_test_41bD7e0aC93f2d18b6c5" />
3069
+ </div>
3070
+ </div>
3071
+ )
3072
+ }
3073
+
3074
+ namespace styles {
3075
+ export const field = style({ display: 'grid', gap: '8' })
3076
+
3077
+ export const header = style({
3078
+ alignItems: 'baseline',
3079
+ display: 'flex',
3080
+ gap: '12',
3081
+ justifyContent: 'space-between',
3082
+ })
3083
+
3084
+ export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
3085
+
3086
+ export const list = style({ display: 'grid', gap: '16', width: '100% !custom' })
3087
+
3088
+ export const meta = style({ color: 'content.secondary', typography: 'body.b3' })
3089
+ }
3090
+ ```
3091
+
3092
+ **Don't:** Leave people to tell keys apart by revealing them.
3093
+
3094
+ ```tsx
3095
+ /**
3096
+ * Don't example for "Name Every Secret" on the SecretValue page.
3097
+ * Don't leave people to tell keys apart by revealing them.
3098
+ * @module
3099
+ */
3100
+ import { SecretValue, style } from '@tempoxyz/ds'
3101
+
3102
+ /** Renders the static preview, which the guideline card shows inert. */
3103
+ export function Demo() {
3104
+ return (
3105
+ <div {...styles.list()}>
3106
+ <SecretValue label="Production API key" size="small" value="tk_live_9fA2c81bE07d4c55a3e6" />
3107
+ <SecretValue label="Staging API key" size="small" value="tk_test_41bD7e0aC93f2d18b6c5" />
3108
+ </div>
3109
+ )
3110
+ }
3111
+
3112
+ namespace styles {
3113
+ export const list = style({ display: 'grid', gap: '16', width: '100% !custom' })
3114
+ }
3115
+ ```
3116
+
3117
+ #### Keep Each Secret on One Line
3118
+
3119
+ The value does not wrap, and a long revealed value scrolls horizontally.
3120
+
3121
+ **Do:** Give a recovery phrase of 12 or 24 words its own numbered layout, behind the same explicit
3122
+ reveal.
3123
+
3124
+ ```tsx
3125
+ /**
3126
+ * Do example for "Keep Each Secret on One Line" on the SecretValue page.
3127
+ * Give a recovery phrase of 12 or 24 words its own numbered layout, behind the same explicit reveal.
3128
+ * @module
3129
+ */
3130
+ import { style } from '@tempoxyz/ds'
3131
+
3132
+ const words = [
3133
+ 'orbit',
3134
+ 'maple',
3135
+ 'ledger',
3136
+ 'canyon',
3137
+ 'velvet',
3138
+ 'harbor',
3139
+ 'quartz',
3140
+ 'ember',
3141
+ 'signal',
3142
+ 'meadow',
3143
+ 'falcon',
3144
+ 'summit',
3145
+ ] as const
3146
+
3147
+ /** Renders the static preview, which the guideline card shows inert. */
3148
+ export function Demo() {
3149
+ return (
3150
+ <div {...styles.field()}>
3151
+ <span {...styles.label()}>Recovery phrase</span>
3152
+ <ol {...styles.grid()}>
3153
+ {words.map((word, index) => (
3154
+ <li key={word} {...styles.word()}>
3155
+ <span {...styles.index()}>{index + 1}</span>
3156
+ {word}
3157
+ </li>
3158
+ ))}
3159
+ </ol>
3160
+ </div>
3161
+ )
3162
+ }
3163
+
3164
+ namespace styles {
3165
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
3166
+
3167
+ export const grid = style({
3168
+ display: 'grid',
3169
+ gap: '8',
3170
+ gridTemplateColumns: 'repeat(3, 1fr) !custom',
3171
+ listStyle: 'none',
3172
+ margin: '0',
3173
+ padding: '0',
3174
+ })
3175
+
3176
+ export const index = style({ color: 'content.secondary', minWidth: '1.25rem !custom' })
3177
+
3178
+ export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
3179
+
3180
+ export const word = style({
3181
+ backgroundColor: 'container.regular',
3182
+ borderRadius: '2xs',
3183
+ color: 'content.primary',
3184
+ display: 'flex',
3185
+ gap: '4',
3186
+ padding: '8',
3187
+ typography: 'mono.m1',
3188
+ })
3189
+ }
3190
+ ```
3191
+
3192
+ **Don't:** Put a recovery phrase in one scrolling line.
3193
+
3194
+ ```tsx
3195
+ /**
3196
+ * Don't example for "Keep Each Secret on One Line" on the SecretValue page.
3197
+ * Don't put a recovery phrase in one scrolling line.
3198
+ * @module
3199
+ */
3200
+ import { SecretValue, style } from '@tempoxyz/ds'
3201
+
3202
+ /** Renders the static preview, which the guideline card shows inert. */
3203
+ export function Demo() {
3204
+ return (
3205
+ <div {...styles.field()}>
3206
+ <span {...styles.label()}>Recovery phrase</span>
3207
+ <SecretValue
3208
+ defaultRevealed
3209
+ label="Recovery phrase"
3210
+ value="orbit maple ledger canyon velvet harbor quartz ember signal meadow falcon summit"
3211
+ />
3212
+ </div>
3213
+ )
3214
+ }
3215
+
3216
+ namespace styles {
3217
+ export const field = style({ display: 'grid', gap: '8', width: '100% !custom' })
3218
+
3219
+ export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
3220
+ }
3221
+ ```
3222
+
3223
+ ### Content
3224
+
3225
+ * **Visibility:** If a key is shown once, write Store this key now. You can't view it again.
3226
+ * **Leaks:** Link to the replacement action, such as Rotate key.
3227
+
3228
+ ### Accessibility
3229
+
3230
+ SecretValue renders a named `group` with a masked `<code>` value, a reveal toggle, and a copy button. Both buttons follow the [WAI-ARIA Authoring Practices button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/).
3231
+
3232
+ #### Semantics
3233
+
3234
+ * **Root (group):** Takes its name from the `label` prop.
3235
+ * **Value (16 dots):** Screen readers read the dots, never the secret. The mask hides the length and blocks selection.
3236
+ * **Reveal Button (aria-pressed):** A native button named "Reveal" that reports whether the secret is shown.
3237
+ * **Copy Button (button):** A native button named "Copy". It reads "Copied" for two seconds, and a polite status region announces each copy.
3238
+ * **Pointer Shortcut (click):** A click on the block copies without a reveal. Keyboard users use the copy button.
3239
+
3240
+ #### Keyboard
3241
+
3242
+ * **Move Between Buttons (Tab):** Moves focus to the reveal button, then to the copy button. The value takes no focus.
3243
+ * **Reveal or Copy (Enter or Space):** The reveal button shows or hides the secret. The copy button copies it. Focus stays on the pressed button.
3244
+
3245
+ #### Your Responsibilities
3246
+
3247
+ * **Allow Paste (SC 3.3.8):** Do not block paste where people use the secret. [Accessible authentication](https://www.w3.org/WAI/WCAG22/Understanding/accessible-authentication-minimum.html) relies on it.
3248
+
3249
+ ### Related
3250
+
3251
+ [Snippet](data-display.md#snippet)
3252
+
3253
+ Use for values that aren't secret.
3254
+
3255
+ [CopyButton](actions.md#copybutton)
3256
+
3257
+ Use for copying beside your own layout.
3258
+
3259
+ [TextInput](forms-and-inputs.md#textinput)
3260
+
3261
+ Use for entering a secret.
3262
+
3263
+ [Destructive Actions](../patterns.md#destructive-actions)
3264
+
3265
+ Covers revoking and rotating keys.
3266
+
3267
+ [Tempo Console](../patterns.md#tempo-console)
3268
+
3269
+ Covers API key screens.
3270
+
3271
+ ### Examples
3272
+
3273
+ #### Basic
3274
+
3275
+ ```tsx
3276
+ import { SecretValue, style } from '@tempoxyz/ds'
3277
+
3278
+ export const fill = true
3279
+ export function Demo() {
3280
+ return (
3281
+ <SecretValue label="API key" value="sk_demo_4eC39HqLyjWDarjtT1zdp7dc" {...styles.value()} />
3282
+ )
3283
+ }
3284
+
3285
+ namespace styles {
3286
+ export const value = style({ maxWidth: '28rem !custom' })
3287
+ }
3288
+ ```
3289
+
3290
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SecretValue/Basic.tsx)
3291
+
3292
+ #### Size
3293
+
3294
+ Set `size` to `small`, `medium` (default), or `large`.
3295
+
3296
+ ```tsx
3297
+ import { SecretValue, style } from '@tempoxyz/ds'
3298
+
3299
+ export function Demo() {
3300
+ return (
3301
+ <div {...styles.column()}>
3302
+ {(['small', 'medium', 'large'] as const).map((size) => (
3303
+ <SecretValue
3304
+ key={size}
3305
+ label="API key"
3306
+ size={size}
3307
+ value="sk_demo_4eC39HqLyjWDarjtT1zdp7dc"
3308
+ />
3309
+ ))}
3310
+ </div>
3311
+ )
3312
+ }
3313
+
3314
+ namespace styles {
3315
+ export const column = style({
3316
+ display: 'grid',
3317
+ gap: '12',
3318
+ gridTemplateColumns: 'minmax(0, 28rem) !custom',
3319
+ })
3320
+ }
3321
+ ```
3322
+
3323
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SecretValue/Size.tsx)
3324
+
3325
+ #### DefaultRevealed
3326
+
3327
+ Set `defaultRevealed` to start with the value shown.
3328
+
3329
+ ```tsx
3330
+ import { SecretValue, style } from '@tempoxyz/ds'
3331
+
3332
+ export const fill = true
3333
+ export function Demo() {
3334
+ return (
3335
+ <SecretValue
3336
+ defaultRevealed
3337
+ label="API key"
3338
+ value="sk_demo_4eC39HqLyjWDarjtT1zdp7dc"
3339
+ {...styles.value()}
3340
+ />
3341
+ )
3342
+ }
3343
+
3344
+ namespace styles {
3345
+ export const value = style({ maxWidth: '28rem !custom' })
3346
+ }
3347
+ ```
3348
+
3349
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/SecretValue/DefaultRevealed.tsx)
3350
+
3351
+ ## Token
3352
+
3353
+ Shows which token an amount is in, and opens a picker to change it.
3354
+
3355
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Token.tsx)
3356
+
3357
+ Figma: [Elements/Token](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-1266)
3358
+
3359
+ ### Overview
3360
+
3361
+ A token renders a pill with a [TokenLogo](#tokenlogo) and the token's symbol. By default it is a button with a chevron that opens a token picker. Set `readOnly` for a static pill.
3362
+
3363
+ ### Anatomy
3364
+
3365
+ Import the component and assemble its parts.
3366
+
3367
+ ```tsx
3368
+ import { Token } from '@tempoxyz/ds'
3369
+
3370
+ <Token />
3371
+ ```
3372
+
3373
+ ### Guidelines
3374
+
3375
+ #### When to Use
3376
+
3377
+ * Name the token after the digits in an [AmountInput](forms-and-inputs.md#amountinput), and let a person change it.
3378
+ * Name a fixed token in a review or a receipt with `readOnly`.
3379
+
3380
+ #### When Not to Use
3381
+
3382
+ * Use [TokenLogo](#tokenlogo) for a logo beside a symbol in a list row.
3383
+ * Use [AssetChip](#assetchip) to list the assets a row supports.
3384
+ * Use [Select](forms-and-inputs.md#select) to choose a token in a form field with a label.
3385
+
3386
+ #### Show the Chevron Only on a Picker
3387
+
3388
+ The chevron tells people that the token opens a picker.
3389
+
3390
+ **Do:** Set `readOnly` in reviews and receipts, where the token can't change.
3391
+
3392
+ ```tsx
3393
+ /**
3394
+ * Do example for "Show the Chevron Only on a Picker" on the Token page.
3395
+ * Render a read-only pill where the token can't change.
3396
+ * @module
3397
+ */
3398
+ import { style, Token, TokenLogo } from '@tempoxyz/ds'
3399
+
3400
+ /** Renders the static preview, which the guideline card shows inert. */
3401
+ export function Demo() {
3402
+ return (
3403
+ <TokenLogo.Provider>
3404
+ <div {...styles.row()}>
3405
+ <span {...styles.amount()}>25.00</span>
3406
+ <Token address="0x20c0000000000000000000000000000000000000" readOnly symbol="pathUSD" />
3407
+ </div>
3408
+ </TokenLogo.Provider>
3409
+ )
3410
+ }
3411
+
3412
+ namespace styles {
3413
+ export const amount = style({ color: 'content.primary', typography: 'heading.h2' })
3414
+
3415
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3416
+ }
3417
+ ```
3418
+
3419
+ **Don't:** Show the chevron on a token that opens nothing.
3420
+
3421
+ ```tsx
3422
+ /**
3423
+ * Don't example for "Show the Chevron Only on a Picker" on the Token page.
3424
+ * A chevron on a token that can't change promises a picker that never opens.
3425
+ * @module
3426
+ */
3427
+ import { style, Token, TokenLogo } from '@tempoxyz/ds'
3428
+
3429
+ /** Renders the static preview, which the guideline card shows inert. */
3430
+ export function Demo() {
3431
+ return (
3432
+ <TokenLogo.Provider>
3433
+ <div {...styles.row()}>
3434
+ <span {...styles.amount()}>25.00</span>
3435
+ <Token address="0x20c0000000000000000000000000000000000000" symbol="pathUSD" />
3436
+ </div>
3437
+ </TokenLogo.Provider>
3438
+ )
3439
+ }
3440
+
3441
+ namespace styles {
3442
+ export const amount = style({ color: 'content.primary', typography: 'heading.h2' })
3443
+
3444
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3445
+ }
3446
+ ```
3447
+
3448
+ #### Prefer the Address
3449
+
3450
+ * **Address (address):** Loads the logo directly. `symbol` still labels the pill.
3451
+ * **Symbol (symbol):** Resolves the logo through the token list first.
3452
+
3453
+ ### Content
3454
+
3455
+ #### Use the Token's Symbol
3456
+
3457
+ Write the symbol as the token defines it, such as pathUSD or USDC.e. Keep amounts, network names, and verbs outside the pill.
3458
+
3459
+ ### Accessibility
3460
+
3461
+ A token renders a native `<button>` built on Base UI Button, or a `<span>` when `readOnly`. The logo and the chevron are hidden from screen readers.
3462
+
3463
+ #### Semantics
3464
+
3465
+ * **Root (button):** The symbol names the button. A picker trigger adds popup state.
3466
+ * **Read-Only (readOnly):** Renders a span, so screen readers read the symbol as text.
3467
+
3468
+ #### Keyboard
3469
+
3470
+ * **Move Focus to the Token (Tab):** Moves focus to the token.
3471
+ * **Open the Picker (Enter or Space):** Opens the picker that the token triggers.
3472
+
3473
+ #### Your Responsibilities
3474
+
3475
+ * **Open a Picker (render):** Pass the token to a picker trigger's `render`. If nothing opens, set `readOnly`.
3476
+ * **Describe the Action (aria-label):** If the symbol alone doesn't say what the token does, add a label that keeps the symbol.
3477
+
3478
+ ### Related
3479
+
3480
+ [TokenLogo](#tokenlogo)
3481
+
3482
+ Use for token logos.
3483
+
3484
+ [AmountInput](forms-and-inputs.md#amountinput)
3485
+
3486
+ Use for entering an amount beside a token.
3487
+
3488
+ [AssetChip](#assetchip)
3489
+
3490
+ Use for listing the assets a row supports.
3491
+
3492
+ [Dialog](overlays.md#dialog)
3493
+
3494
+ Use for a token picker.
3495
+
3496
+ ### Examples
3497
+
3498
+ #### Basic
3499
+
3500
+ ```tsx
3501
+ import { Token, TokenLogo } from '@tempoxyz/ds'
3502
+
3503
+ export function Demo() {
3504
+ return (
3505
+ <TokenLogo.Provider>
3506
+ <Token address="0x20c0000000000000000000000000000000000000" symbol="pathUSD" />
3507
+ </TokenLogo.Provider>
3508
+ )
3509
+ }
3510
+ ```
3511
+
3512
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Token/Basic.tsx)
3513
+
3514
+ #### Read-Only
3515
+
3516
+ Set `readOnly` to render a span without the chevron, for reviews and receipts.
3517
+
3518
+ ```tsx
3519
+ import { Token, TokenLogo } from '@tempoxyz/ds'
3520
+
3521
+ export function Demo() {
3522
+ return (
3523
+ <TokenLogo.Provider>
3524
+ <Token address="0x20c0000000000000000000000000000000000000" readOnly symbol="pathUSD" />
3525
+ </TokenLogo.Provider>
3526
+ )
3527
+ }
3528
+ ```
3529
+
3530
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Token/ReadOnly.tsx)
3531
+
3532
+ #### Picker
3533
+
3534
+ Pass the token to a trigger's `render`, such as a [Dialog](overlays.md#dialog) trigger, to open a token picker.
3535
+
3536
+ ```tsx
3537
+ import { Dialog, style, Token, TokenLogo } from '@tempoxyz/ds'
3538
+ import { useState } from 'react'
3539
+
3540
+ const tokens = [
3541
+ ['pathUSD', '0x20c0000000000000000000000000000000000000'],
3542
+ ['USDC.e', '0x20c000000000000000000000b9537d11c60e8b50'],
3543
+ ['USDT0', '0x20c00000000000000000000014f22ca97301eb73'],
3544
+ ] as const
3545
+
3546
+ export function Demo() {
3547
+ const [selected, setSelected] = useState<(typeof tokens)[number]>(tokens[0])
3548
+
3549
+ return (
3550
+ <TokenLogo.Provider>
3551
+ <Dialog.Root>
3552
+ <Dialog.Trigger render={<Token address={selected[1]} symbol={selected[0]} />} />
3553
+ <Dialog.Popup closeButton>
3554
+ <Dialog.Header>
3555
+ <Dialog.Title>Select token</Dialog.Title>
3556
+ </Dialog.Header>
3557
+ <Dialog.Body>
3558
+ <div {...styles.list()}>
3559
+ {tokens.map((token) => (
3560
+ <Dialog.Close
3561
+ key={token[1]}
3562
+ onClick={() => setSelected(token)}
3563
+ render={<button type="button" {...styles.option()} />}
3564
+ >
3565
+ <TokenLogo address={token[1]} size="large" />
3566
+ {token[0]}
3567
+ </Dialog.Close>
3568
+ ))}
3569
+ </div>
3570
+ </Dialog.Body>
3571
+ </Dialog.Popup>
3572
+ </Dialog.Root>
3573
+ </TokenLogo.Provider>
3574
+ )
3575
+ }
3576
+
3577
+ namespace styles {
3578
+ export const list = style({ display: 'grid', gap: '4' })
3579
+
3580
+ export const option = style({
3581
+ alignItems: 'center',
3582
+ backgroundColor: 'transparent !custom',
3583
+ border: 'none !custom',
3584
+ borderRadius: 'xs',
3585
+ color: 'content.primary',
3586
+ cursor: 'pointer',
3587
+ display: 'flex',
3588
+ gap: '12',
3589
+ padding: '12',
3590
+ textAlign: 'start',
3591
+ typography: 'body.b2Strong',
3592
+ selectors: { '&:hover': { backgroundColor: 'container.regular' } },
3593
+ })
3594
+ }
3595
+ ```
3596
+
3597
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Token/Picker.tsx)
3598
+
3599
+ ## TokenLogo
3600
+
3601
+ Shows a token logo by contract address or symbol.
3602
+
3603
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/TokenLogo.tsx)
3604
+
3605
+ Figma: [Elements/Logo](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-2546)
3606
+
3607
+ ### Overview
3608
+
3609
+ A token logo renders a stablecoin's artwork, found by contract address or symbol, with its brand colors. Its `alt` is empty unless set, which suits a logo beside the token name.
3610
+
3611
+ ### Anatomy
3612
+
3613
+ Import the component and assemble its parts.
3614
+
3615
+ ```tsx
3616
+ import { TokenLogo } from '@tempoxyz/ds'
3617
+
3618
+ <TokenLogo.Provider>
3619
+ <TokenLogo />
3620
+ </TokenLogo.Provider>
3621
+ ```
3622
+
3623
+ ### Guidelines
3624
+
3625
+ #### When to Use
3626
+
3627
+ * Show a token's logo beside its symbol in balance lists, token selectors, payment reviews, and activity rows.
3628
+
3629
+ #### When Not to Use
3630
+
3631
+ * Use [Token](#token-1) to show which token an amount is in, and to let a person change it.
3632
+ * Use [Identicon](#identicon) for an account address.
3633
+ * Use [Avatar](data-display.md#avatar) for people and organizations.
3634
+ * Use [IconTile](data-display.md#icontile) for a feature or category icon.
3635
+ * Use [NetworkLogo](#networklogo) for the chain a token lives on.
3636
+ * Use [AssetChip](#assetchip) to list the assets a row supports.
3637
+
3638
+ #### Pair the Icon With the Symbol
3639
+
3640
+ Many token icons look alike, and an unknown token can copy a well-known icon.
3641
+
3642
+ **Do:** Show the symbol beside each token icon.
3643
+
3644
+ ```tsx
3645
+ /**
3646
+ * Do example for "Pair the Icon With the Symbol" on the TokenLogo page.
3647
+ * Show the symbol beside each token icon.
3648
+ * @module
3649
+ */
3650
+ import { style, TokenLogo } from '@tempoxyz/ds'
3651
+
3652
+ const tokens = [
3653
+ ['pathUSD', '0x20c0000000000000000000000000000000000000'],
3654
+ ['USDC.e', '0x20c000000000000000000000b9537d11c60e8b50'],
3655
+ ['EURC.e', '0x20c0000000000000000000001621e21f71cf12fb'],
3656
+ ] as const
3657
+
3658
+ /** Renders the static preview, which the guideline card shows inert. */
3659
+ export function Demo() {
3660
+ return (
3661
+ <TokenLogo.Provider>
3662
+ <div {...styles.list()}>
3663
+ {tokens.map(([symbol, address]) => (
3664
+ <div key={address} {...styles.row()}>
3665
+ <TokenLogo address={address} />
3666
+ <span {...styles.symbol()}>{symbol}</span>
3667
+ </div>
3668
+ ))}
3669
+ </div>
3670
+ </TokenLogo.Provider>
3671
+ )
3672
+ }
3673
+
3674
+ namespace styles {
3675
+ export const list = style({ display: 'grid', gap: '12' })
3676
+
3677
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3678
+
3679
+ export const symbol = style({ color: 'content.primary', typography: 'body.b2Strong' })
3680
+ }
3681
+ ```
3682
+
3683
+ **Don't:** Ask people to tell tokens apart by icon alone.
3684
+
3685
+ ```tsx
3686
+ /**
3687
+ * Don't example for "Pair the Icon With the Symbol" on the TokenLogo page.
3688
+ * Don't ask people to tell tokens apart by icon alone.
3689
+ * @module
3690
+ */
3691
+ import { style, TokenLogo } from '@tempoxyz/ds'
3692
+
3693
+ const addresses = [
3694
+ '0x20c0000000000000000000000000000000000000',
3695
+ '0x20c000000000000000000000b9537d11c60e8b50',
3696
+ '0x20c0000000000000000000001621e21f71cf12fb',
3697
+ ] as const
3698
+
3699
+ /** Renders the static preview, which the guideline card shows inert. */
3700
+ export function Demo() {
3701
+ return (
3702
+ <TokenLogo.Provider>
3703
+ <div {...styles.row()}>
3704
+ {addresses.map((address) => (
3705
+ <TokenLogo address={address} key={address} />
3706
+ ))}
3707
+ </div>
3708
+ </TokenLogo.Provider>
3709
+ )
3710
+ }
3711
+
3712
+ namespace styles {
3713
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3714
+ }
3715
+ ```
3716
+
3717
+ #### Prefer the Address
3718
+
3719
+ * **Address (address):** Use it when you have it. It loads the image directly and names one contract.
3720
+ * **Symbol (symbol):** Resolves through the token list first, which adds a request. Different tokens can share a symbol.
3721
+ * **Lists (TokenLogo.Provider):** Wrap lists so tokens share one lookup per symbol and a default `chainId`.
3722
+
3723
+ Pass `resolveSrc` or `resolveAddress` to `TokenLogo.Provider` to load icons or addresses from your own source.
3724
+
3725
+ #### Show Unknown Tokens as Unknown
3726
+
3727
+ A gray circle renders while an icon loads or after it fails.
3728
+
3729
+ **Do:** Show the address in a [Hex](#hex) beside the symbol of a token that isn't on the
3730
+ list.
3731
+
3732
+ ```tsx
3733
+ /**
3734
+ * Do example for "Show Unknown Tokens as Unknown" on the TokenLogo page.
3735
+ * Show the address in a Hex beside the symbol of a token that isn't on the list.
3736
+ * @module
3737
+ */
3738
+ import { Hex, style, TokenLogo } from '@tempoxyz/ds'
3739
+
3740
+ const address = '0x20c00000000000000000000098a3f2c1e5d70b44'
3741
+
3742
+ /** Renders the static preview, which the guideline card shows inert. */
3743
+ export function Demo() {
3744
+ return (
3745
+ <div {...styles.row()}>
3746
+ <TokenLogo address={address} />
3747
+ <div {...styles.text()}>
3748
+ <span {...styles.symbol()}>USDC</span>
3749
+ <Hex size="small" value={address} />
3750
+ </div>
3751
+ </div>
3752
+ )
3753
+ }
3754
+
3755
+ namespace styles {
3756
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12', minWidth: '0' })
3757
+
3758
+ export const symbol = style({ color: 'content.primary', typography: 'body.b2Strong' })
3759
+
3760
+ export const text = style({ display: 'grid', gap: '4', minWidth: '0' })
3761
+ }
3762
+ ```
3763
+
3764
+ **Don't:** Show only the symbol. Any token can claim it.
3765
+
3766
+ ```tsx
3767
+ /**
3768
+ * Don't example for "Show Unknown Tokens as Unknown" on the TokenLogo page.
3769
+ * Don't show only the symbol. Any token can claim it.
3770
+ * @module
3771
+ */
3772
+ import { style, TokenLogo } from '@tempoxyz/ds'
3773
+
3774
+ const address = '0x20c00000000000000000000098a3f2c1e5d70b44'
3775
+
3776
+ /** Renders the static preview, which the guideline card shows inert. */
3777
+ export function Demo() {
3778
+ return (
3779
+ <div {...styles.row()}>
3780
+ <TokenLogo address={address} />
3781
+ <span {...styles.symbol()}>USDC</span>
3782
+ </div>
3783
+ )
3784
+ }
3785
+
3786
+ namespace styles {
3787
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3788
+
3789
+ export const symbol = style({ color: 'content.primary', typography: 'body.b2Strong' })
3790
+ }
3791
+ ```
3792
+
3793
+ #### Match Size to the Context
3794
+
3795
+ * **Small (16px):** Inline beside an amount.
3796
+ * **Medium (20px):** The default, and the logo in a [Token](#token-1).
3797
+ * **Large (32px):** In asset rows and token pickers.
3798
+
3799
+ ### Accessibility
3800
+
3801
+ A token logo renders a native `<img>`, decorative by default. It is not interactive and takes no focus.
3802
+
3803
+ #### Semantics
3804
+
3805
+ * **Root (img):** Has empty alt text by default, so screen readers skip it beside a visible name.
3806
+ * **Loading and Errors:** Renders a gray circle while loading or after an error. Text must identify the token.
3807
+ * **Data Status (data-status):** Reports `loading`, `loaded`, or `error` for styling. Screen readers don't announce it.
3808
+
3809
+ #### Your Responsibilities
3810
+
3811
+ * **Name a Standalone Icon (alt):** If the icon stands alone, such as in an icon-only selector, pass the token name.
3812
+
3813
+ ### Related
3814
+
3815
+ [Amount](#amount)
3816
+
3817
+ Use for token amounts.
3818
+
3819
+ [Token](#token-1)
3820
+
3821
+ Use for a token pill that labels or picks a token.
3822
+
3823
+ [AssetChip](#assetchip)
3824
+
3825
+ Use for listing the assets a row supports.
3826
+
3827
+ [NetworkLogo](#networklogo)
3828
+
3829
+ Use for the chain a token lives on.
3830
+
3831
+ [Identicon](#identicon)
3832
+
3833
+ Use for account addresses.
3834
+
3835
+ [Avatar](data-display.md#avatar)
3836
+
3837
+ Use for people and organizations.
3838
+
3839
+ [Select](forms-and-inputs.md#select)
3840
+
3841
+ Use for token selectors.
3842
+
3843
+ [Blockchain Values](../patterns.md#blockchain-values)
3844
+
3845
+ Covers tokens and addresses.
3846
+
3847
+ ### Examples
3848
+
3849
+ #### Basic
3850
+
3851
+ ```tsx
3852
+ import { style, TokenLogo } from '@tempoxyz/ds'
3853
+
3854
+ export function Demo() {
3855
+ return (
3856
+ <TokenLogo.Provider>
3857
+ <div {...styles.row()}>
3858
+ <TokenLogo address="0x20c0000000000000000000000000000000000000" />
3859
+ pathUSD
3860
+ </div>
3861
+ </TokenLogo.Provider>
3862
+ )
3863
+ }
3864
+
3865
+ namespace styles {
3866
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3867
+ }
3868
+ ```
3869
+
3870
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/TokenLogo/Basic.tsx)
3871
+
3872
+ #### Size
3873
+
3874
+ Set `size` to `small` (16px), `medium` (20px, default), or `large` (32px).
3875
+
3876
+ ```tsx
3877
+ import { style, TokenLogo } from '@tempoxyz/ds'
3878
+
3879
+ const tokens = [
3880
+ ['pathUSD', '0x20c0000000000000000000000000000000000000'],
3881
+ ['USDC.e', '0x20c000000000000000000000b9537d11c60e8b50'],
3882
+ ['EURC.e', '0x20c0000000000000000000001621e21f71cf12fb'],
3883
+ ['USDT0', '0x20c00000000000000000000014f22ca97301eb73'],
3884
+ ['frxUSD', '0x20c0000000000000000000003554d28269e0f3c2'],
3885
+ ] as const
3886
+
3887
+ export function Demo() {
3888
+ return (
3889
+ <TokenLogo.Provider>
3890
+ <div {...styles.grid()}>
3891
+ {tokens.map(([label, address]) => (
3892
+ <div key={address} {...styles.row()}>
3893
+ {(['small', 'medium', 'large'] as const).map((size) => (
3894
+ <TokenLogo address={address} key={size} size={size} />
3895
+ ))}
3896
+ {label}
3897
+ </div>
3898
+ ))}
3899
+ </div>
3900
+ </TokenLogo.Provider>
3901
+ )
3902
+ }
3903
+
3904
+ namespace styles {
3905
+ export const grid = style({ display: 'grid', gap: '12' })
3906
+
3907
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3908
+ }
3909
+ ```
3910
+
3911
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/TokenLogo/Size.tsx)
3912
+
3913
+ #### Symbol
3914
+
3915
+ Pass `symbol` instead of `address` to resolve the token through the token list.
3916
+
3917
+ ```tsx
3918
+ import { style, TokenLogo } from '@tempoxyz/ds'
3919
+
3920
+ export function Demo() {
3921
+ return (
3922
+ <TokenLogo.Provider>
3923
+ <div {...styles.row()}>
3924
+ <TokenLogo size="large" symbol="pathUSD" />
3925
+ By symbol: pathUSD
3926
+ </div>
3927
+ </TokenLogo.Provider>
3928
+ )
3929
+ }
3930
+
3931
+ namespace styles {
3932
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3933
+ }
3934
+ ```
3935
+
3936
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/TokenLogo/Symbol.tsx)
3937
+
3938
+ #### Fallback
3939
+
3940
+ An unknown address or symbol renders a placeholder.
3941
+
3942
+ ```tsx
3943
+ import { style, TokenLogo } from '@tempoxyz/ds'
3944
+
3945
+ export function Demo() {
3946
+ return (
3947
+ <TokenLogo.Provider>
3948
+ <div {...styles.grid()}>
3949
+ <div {...styles.row()}>
3950
+ <TokenLogo address="0x0000000000000000000000000000000000000001" size="large" />
3951
+ Unknown address (service placeholder)
3952
+ </div>
3953
+ <div {...styles.row()}>
3954
+ <TokenLogo size="large" symbol="UNKNOWN" />
3955
+ Unknown symbol (fallback)
3956
+ </div>
3957
+ </div>
3958
+ </TokenLogo.Provider>
3959
+ )
3960
+ }
3961
+
3962
+ namespace styles {
3963
+ export const grid = style({ display: 'grid', gap: '12' })
3964
+
3965
+ export const row = style({ alignItems: 'center', display: 'flex', gap: '12' })
3966
+ }
3967
+ ```
3968
+
3969
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/TokenLogo/Fallback.tsx)