reopt design
DocsExploreTemplatesCanvasToolsPricing
Login
opt-uiopt-chartsopt-datagridopt-editoropt-calendaropt-filemanageropt-chatopt-shellbrandapp-ui
Overview205Core74Shells99Blocks32
CopyButton
reopt designreopt design

A design system for the AI era

  • Docs
  • Pricing
  • Releases
  • About
  • Contact
  • Terms of Service
  • Privacy Policy

reopt Inc.Business registration no. 217-88-02453contact@reopt.ai

© 2026 reopt Inc. All rights reserved.

CopyButton

Component

Copy a value to the clipboard and report success or clipboard permission failures.

Related docs
bun add @reopt-ai/opt-ui
Install and import
bash
bun add @reopt-ai/opt-ui
tsx
import { CopyButton } from "@reopt-ai/opt-ui";

Live preview

Change the width and theme, then interact with the components.

100%

In a table cell

purchase_completed

With a label

Reporting the outcome

아직 복사하지 않음

Usage guidance

Best practices

  • Show the text to be copied beside the button and identify the copy target through labels.
  • Use the onCopy result to explain failures. Clipboard access depends on a secure context and browser permissions.

Usage to avoid

  • Show success only after onCopy(true), not simply after a click.

Usage examples

Offer manual copying after clipboard failure

CopyButton

PropTypeDefaultDescription
valueRequiredstring—복사할 텍스트
variant"icon" | "text""icon"글리프만 / 글리프 + 라벨
size"sm" | "md""md"버튼 크기
feedbackDurationnumber1500확인 상태 유지 시간 (ms)
onCopy(ok: boolean) => void—실제로 복사됐는지 — 비보안 컨텍스트·권한 거부에서 false
labelsCopyButtonLabels—copy / copied / failed 문구
View test results

테스트 커버리지

2026년 7월 9일

생성된 테스트 결과를 찾지 못했습니다.

CopyButton 항목이 문서 메타에 연결되어 있지만 현재 생성 파일에는 없습니다.

테스트를 추가한 뒤 `bun run generate:test-results`를 실행하거나 `testDescribe` 매핑을 다시 확인하세요.

Related components

opt-ui

FieldToken

Core

Display field types with consistent glyphs and optional labels for strings, numbers, dates, IP addresses, and geographic data.

opt-ui

Facet

Core

Filter by field values while reading their counts and distribution bars. Show top values first and collapse the long tail.

opt-ui

Expression

Core

Read and edit conditions as sentences for alert rules and segment filters that need to be easy to verify.

opt-ui

TextTruncate

Core

Measure text in its actual font and available width to truncate the start, middle, or both ends while preserving the full accessible text.

opt-ui

Highlight

Core

Mark matching search terms with semantic mark elements, matching longer terms first to avoid fragmented overlaps.

opt-ui

LiveRegion

Core

Announce live updates to screen readers with throttled summaries and alternating nodes that can repeat identical messages.

PreviousStatusDotNextSegmentedControl