# copyable-text

- 分组：组合组件（Composite）
- 页面：/components/copyable-text
- 源码：packages/react/src/components/copyable-text.tsx

## 导出

```ts
import { CopyableText } from "@modra/react";
```

## Props（CopyableTextProps）

| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| `value` | 否 | `string` | Text written to the clipboard. Defaults to the rendered children string. |
| `copyLabel` | 否 | `string` | Accessible label for the copy control. Defaults to the locale's `CopyableText.copy`. |
| `copiedLabel` | 否 | `string` | Accessible label shown after a successful copy. Defaults to `CopyableText.copied`. |
| `unsupportedLabel` | 否 | `string` | Accessible label shown when the clipboard API is unavailable. Defaults to `CopyableText.unsupported`. |
| `resetDelay` | 否 | `number` | Duration of the copied state in milliseconds. |
| `onCopy` | 否 | `(value: string) => void` | Called after the clipboard write succeeds. |
| `truncate` | 否 | `boolean` | Single-line truncation through `TruncatedText`: the text ellipsizes, and the full value is shown in a tooltip (with a keyboard focus stop) only when it is actually clipped. The copy button never shrinks, so it stays visible however narrow the control gets. |
| `monospace` | 否 | `boolean` | Renders the text in the monospace code font, for identifiers, keys and hashes. |
| `maxWidth` | 否 | `number \| string` | Caps the width of the whole control (text + copy button). Numbers are pixels. |
