Copy Button

@sushindustries/ui

A glass chip that writes to the clipboard and confirms in the button itself.

Last updated Aug 17, 20265 min read
View as MarkdownEdit on GitHub

Props

PropTypeDefaultDoes
textstring-What lands on the clipboard.
label?string"Copy"Visible label at rest. The copied state always says "Copied".
ground?"slab" | "paper" | "accent""slab"Which material the chip sits on. slab is the charcoal of a code block; paper is everywhere else. The chip is glass either way - the ground decides what the glass is made of.
icon?IconName"copy"Leading glyph at rest. The tick still takes over while copied.

Notes

ground="slab" is the default and also the value that gets no data-ground attribute at all - the stylesheet's un-attributed rule already draws the slab recipe, so slab is "say nothing" rather than "say slab explicitly".

There is no onCopy callback and no way to read whether the last copy succeeded from outside the component - the copied state is purely visual and resets on its own timer. A caller that needs to know the result should call navigator.clipboard itself rather than trying to observe this button.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content
Used byCode BlockCode BlockA highlighted code slab with the CLI's colours, a lit top edge, and a copy button that confirms in place.@sushindustries/ui · contentSecret RevealSecret RevealA credential shown once: it wraps rather than scrolls, one click selects all of it, and the copy button sits under it rather than over it.@sushindustries/ui · contentShowcaseShowcaseA component in a real iframe at every width it has to survive, side by side, with its source and install commands.@sushindustries/ui · docs
Mentioned inCode Block