Getting startedComponentsDesign tokensThemingTheme synthesizerFrameworksAccessibilityUtilitiesServer renderingBrowser supportContributingChangelogApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip
ARC UIARC Radiant Components
v4.9DocsComponentsTokensSynthesizer
Getting startedFrameworksServer renderingDesign tokensThemingTheme synthesizerTypographyUtilitiesAll componentsAccessibilityBrowser supportChangelogContributingStatsApp ShellAspect GridAuth ShellCenterContainerDashboard GridFloat BarInsetMasonryPage HeaderPage LayoutResizableResponsive SwitcherSectionSettings LayoutSplit PaneStatus BarStickyToolbarAnchor NavBottom NavBreadcrumbBreadcrumb MenuCommand BarDrawerFooterLinkMenubarNavigation MenuPage IndicatorPaginationRailScroll IndicatorScroll SpyScroll To TopSidebarSkip LinkStepper NavTabsTop BarTree ViewAccordionAspect RatioAvatarAvatar GroupCardCarouselCollapsibleColor SwatchCTA BannerDividerEmpty StateFeature CardIconImageImage CompareImage HotspotsInfinite ScrollLightboxMarqueeQR CodeScroll AreaSkeletonSpinnerStackVideoVirtual ListActivity HeatmapAnimated NumberBadgeBar ListChartClockComparisonCountdown TimerData GridDescription ListDiffGaugeJSON TreeKanbanLevel MeterListMeterSparklineStatStepperTagTimelineUptimeValue CardWaveformBlockquoteCode BlockCode GroupGradient TextHighlightKbdKeyboard MapMarkdownNumber FormatProseTerminalTextTime AgoTruncateTypewriterButtonButton GroupCalendarCheckboxChipColor PickerComboboxCopy ButtonDate PickerDate Range PickerField ListFieldsetFile UploadFormHotkeyIcon ButtonImage CropperInline EditInputInput GroupKnobLabelMasked InputMulti SelectNumber InputPassword InputPin InputRadio GroupRange SliderRatingSearchSegmented ControlSelectSignature PadSliderSortable ListSwitch GroupTag InputTextareaTheme ToggleTime PickerToggleTransfer ListTree SelectAlertAnnouncementBannerCommand PaletteConfirmConnection StatusContext MenuConversationDialogDropdown MenuHover CardLoading OverlayNotification PanelPopoverProgressSheetToastTooltip

Copy Button

A button that copies a string to the clipboard and shows "Copied!" when the copy works.

ComponentsCopy Button
inputinteractive
<arc-copy-button>

Overview

CopyButton writes its `value` to the clipboard when clicked. It shows a clipboard icon and the word "Copy". After a successful copy it turns success-colored with a check mark and "Copied!" for 2 seconds, then goes back, and fires `arc-copy` with the copied value. It uses `navigator.clipboard.writeText`, which needs a secure context (HTTPS or localhost). If the write fails, as it can in a non-secure iframe, the error is swallowed and the button doesn't change, so nothing tells the user it failed. `icon-only` drops the word and draws a round, borderless 30px button for toolbars, whose check shows for 1.4 seconds. Its accessible name is "Copy to clipboard", or your `label` (such as "Copy code"), and "Copied" after a copy.

Guidelines

Do

  • Put it next to the text it copies, such as a code snippet, URL or API key
  • Set `value` to the exact string people expect to paste, not a formatted or truncated version
  • Set `label` when several copy buttons share a page, so each name says what it copies
  • Serve the page over HTTPS so the Clipboard API is available
  • Set `disabled` until the value exists, for example while it loads

Don't

  • Don't put it inside another button or interactive element. HTML doesn't allow nested interactive content
  • Don't rely on the "Copied!" state alone. Pair it with a toast from `arc-copy` for people who look away

Features

  • Clicks are ignored while the "Copied!" state is showing
  • `disabled` lowers the opacity and blocks pointer events

Preview

npm install @arclux/arc-ui

Usage

This component needs JavaScript. Use the Web Component or a framework wrapper.

<arc-copy-button value="npm install @arclux/arc-ui"></arc-copy-button>

API

valuestring''
The text string to copy to the clipboard when the button is clicked.
labelstring''
Accessible name before copying, such as "Copy code". Defaults to "Copy to clipboard". After copying the name is "Copied".
disabledbooleanfalse
Disables the button, preventing clicks and reducing visual opacity.
iconOnlybooleanfalse
Shows the icon alone in a round, borderless 30px button, for a toolbar or a header bar. The icon turns into a check for 1.4 seconds after copying.

Events

arc-copydetail:{ value: string }
Fired when text is successfully copied to the clipboard. event.detail.value contains the copied string.

See also