Codes and secrets
import { CodeInput, CodeDisplay, KeyBlock, CopyButton, copyText, setClipboardBridge } from "@arcadia/ui";482913
KT7M
CodeInput
length- number
- Default:
6 kind- "numeric" | "alphanumeric"
- Default:
"numeric" value- string
defaultValue- string
- Default:
"" onValueChange- (value: string) => void
onComplete- (value: string) => void
invalid- boolean
- Default:
false success- boolean
- Default:
false disabled- boolean
- Default:
false autoFocus- boolean
- Default:
false group- number
- Default:
3 label- string
name- string
id- string
rootStyle- RootStyle
- A component's typed override prop:
Layoutand its documented knobs, each the references it takes or another kit knob of its kind; anything else is a type error at the call site (STYLEX.md).
coderequired- string
- The code, without separators ("482913").
group- number
- Default:
3 - Characters per visual group (a gap, never a character, separates them).
size- "md" | "lg"
- Default:
"lg" lgfor the one code a screen is about;mdinside a row or a sheet.label- string
- Default:
"Code" - What the code is, for assistive tech ("Code"): the group's name, never drawn.
rootStyle- RootStyle
- Typed StyleX override: layout only.
valuerequired- string
perLine- number
- Default:
4 labelrequired- string
actions- ReactNode
onCopied- () => void
rootStyle- RootStyle
- A component's typed override prop:
Layoutand its documented knobs, each the references it takes or another kit knob of its kind; anything else is a type error at the call site (STYLEX.md).
textrequired- string | (() => string)
- The text written to the clipboard (or a function that produces it at click time).
label- string
- Default:
"Copy" - The label at rest.
copiedLabel- string
- Default:
"Copied" - The label for COPIED_HOLD_MS after a copy that landed.
failedLabel- string
- Default:
"Couldn't copy" - The label after a copy the clipboard refused.
iconOnly- boolean
- Default:
false - Draw only the glyph (an IconButton named by
label). clipboard- ClipboardWriteOptions
- Clipboard options:
clearAfterMsfor a secret. onCopied- (ok: boolean) => void
- Called after every copy with whether it landed.
variant- "primary" | "secondary" | "ghost" | "text" | "danger" | "bare"
- Default:
"secondary" primaryis the monochrome ink CTA, for the one action that moves the flow forward (send).bareis a row or a line of text that presses: no fill, frame, padding or height of its own, in the text style and ink of the line it stands in, its label on its capitals, its ink a step up under the pointer.size- "xs" | "sm" | "md" | "lg"
- Default:
"sm" - Heights 20 / 24 / 28 / 32:
xsandsmstand in a Caption pair,mdin Body,lgin Headline, all bold. tone- "neutral"
density- "compact" | "large"
hint- ShortcutSpec | ReactElement
- Trailing key hint, drawn quietly:
"⇧Tab","⏎",["⌘","K"],"mod+k", or aKbd. It stands at the end of a button wider than its words (a search trigger), the label taking the room between. Visual only (aria-hidden, so the name stays "Allow", not "Allow ⏎"); the keys are exposed asaria-keyshortcutson the button. Binding the key is yours. progress- number
- Determinate progress, 0..1: a ring fills in the icon's slot (a download, an upload) while the label says the number. The button stays pressable;
loadingwins when both are set. labelRow- boolean
- The label is a row of parts (an avatar beside words), each on its capitals.
wrap- boolean
- Default:
false - Its label wraps onto more lines instead of running past the button, growing it: a choice whose words are longer than a narrow column. One line keeps the control's height.
roundEnds- boolean
- Each side that ends in text takes the room its round end cuts (R12) under a pill's corner too. A pill always takes it.
rootStyle- ButtonStyle
- Typed StyleX override: where the button sits (margins, self-alignment, flex and grid placement, size bounds) and its
--button-*knobs. render- RenderProp<{ disabled: boolean }>
- Replace the rendered element, e.g.
render={<a href="/settings" />}, or a function of props and state. disabled- boolean
- Native disabled: no pointer events, no tooltip, skipped by Tab.
focusableWhenDisabled- boolean
- Keep a disabled control focusable and hoverable (
aria-disabled), so a tooltip can say why. nativeButton- boolean
- Button semantics, inferred from what renders: a
<button>is native, an<a>stays a link, anything else getsrole="button"and key handling.falseforces button semantics on whatever renders (a link acting as a button).
Rest props go to <button> props.
State machine
482913