Aurora CopyButton
aurora-dinglebear-ai/aurora-copy-buttonUnverifiedComponent
Aurora CopyButton — Claude Design parity.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/dinglebear-ai/aurora/main/aurora-copy-button.jsonSource
1"use client"23/**4 * Aurora CopyButton — copy-to-clipboard action control.5 *6 * Aurora extension matching the Claude Design source 1:1. A neutral lit-outline7 * button (border + glow, no flooded fill) that copies `value` to the clipboard8 * and briefly swaps to a "copied" success state. Renders icon-only when no9 * `label` is supplied.10 *11 * Visual layer lives in registry/aurora/styles/aurora-components.css12 * (`@layer aurora-components`, reads only `--aurora-*` tokens) so it renders13 * identically in dark + `.light`. Architecture stays shadcn: `forwardRef`,14 * `displayName`, named + default export, a11y (aria-label, aria-live status).15 */1617import * as React from "react"18import { Check, Copy } from "lucide-react"19import { cn } from "@/lib/utils"20import { useClipboard } from "@/registry/aurora/lib/use-clipboard"2122// Styles: registry/aurora/styles/aurora-components.css (@layer aurora-components).2324// ─── Component ───────────────────────────────────────────────────────────────2526export interface CopyButtonProps27 extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value" | "onCopy"> {28 /** Text written to the clipboard when the button is pressed. */29 value: string30 /** Visible label rendered after the icon. When omitted the button is icon-only. */31 label?: React.ReactNode32 /** Label announced/shown briefly after a successful copy. Defaults to "Copied". */33 copiedLabel?: React.ReactNode34 /** How long the copied state persists, in ms. Defaults to 2000. */35 timeout?: number36 /** Fired after `value` is written to the clipboard. */37 onCopy?: (value: string) => void38}3940function CopyButton(41 {42 ref,43 value,44 label,45 copiedLabel = "Copied",46 timeout = 2000,47 onCopy,48 className,49 onClick,50 disabled,51 "aria-label": ariaLabel,52 ...props53 }: CopyButtonProps & { ref?: React.Ref<HTMLButtonElement> }54) {55 const { state, copied, copy } = useClipboard(timeout)5657 const handleClick = React.useCallback(58 (event: React.MouseEvent<HTMLButtonElement>) => {59 onClick?.(event)60 if (event.defaultPrevented) return6162 void copy(value).then((didCopy) => {63 if (didCopy) onCopy?.(value)64 })65 },66 [onClick, onCopy, value, copy]67 )6869 const isIconOnly = label === undefined || label === null || label === ""70 const resolvedAriaLabel =71// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aurora
All 176 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aurora Accordionaurora-accordion | aurora | Components | Unverified | 2 deps | |
| Aurora Alert Dialogaurora-alert-dialog | aurora | Components | Unverified | 2 deps | |
| Aurora Aspect Ratioaurora-aspect-ratio | aurora | Components | Unverified | no deps | |
| Aurora Avataraurora-avatar | aurora | Components | Unverified | 1 dep | |
| Aurora Badgeaurora-badge | aurora | Components | Unverified | 2 deps | |
| Aurora Banneraurora-banner | aurora | Components | Unverified | 1 dep | |
| Aurora Breadcrumbaurora-breadcrumb | aurora | Components | Unverified | 2 deps | |
| Aurora Buttonaurora-button | aurora | Components | Unverified | 2 deps |
