About
A labeled text field with an icon trigger that copies its value to the clipboard and flashes a success state for a moment after copying.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Clipboard to your project and fits it to your theme.
Code
How Clipboard is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { Clipboard } from "@/components/ui/clipboard";
import { applyTheme, attachDynamicLight } from "@bysages/core";
/** Ark's own copy / check glyphs, taken verbatim from the library's
* clipboard story so the trigger's icon swap matches the source exactly. */
const copyGlyph = (
<svg
width={16}
height={16}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={1.75}
aria-hidden="true"
>
<rect x={9} y={9} width={11} height={11} rx={1.5} />
<path d="M5 15H4.5A1.5 1.5 0 0 1 3 13.5v-9A1.5 1.5 0 0 1 4.5 3h9A1.5 1.5 0 0 1 15 4.5V5" />
</svg>
);
const checkGlyph = (
<svg
width={16}
height={16}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={1.75}
aria-hidden="true"
>
<path d="m5 12.5 4.5 4.5L19 7.5" />
</svg>
);
function CopyTrigger() {
return (
<Clipboard.Trigger>
<Clipboard.Indicator copied={checkGlyph}>{copyGlyph}</Clipboard.Indicator>
</Clipboard.Trigger>
);
}
// The design system ships zero-config token CSS on import, but the demo
// host may prefer dark mode — pin the paper-and-ink theme to light so the
// component always renders in its intended, documented look.
applyTheme({ mode: "light", accent: "ink", density: "default" });
attachDynamicLight();
export default function ClipboardDemo() {
return (
<div
style={{
background: "var(--bs-color-surface-1, #fff)",
color: "var(--bs-color-text-primary, #111)",
padding: "2rem",
display: "grid",
placeItems: "center",
minHeight: "240px",
width: "100%",
}}
>
<Clipboard.Root defaultValue="https://ark-ui.com">
<Clipboard.Label>Copy this link</Clipboard.Label>
<Clipboard.Control>
<Clipboard.Input />
<CopyTrigger />
</Clipboard.Control>
</Clipboard.Root>
</div>
);
}















