Skip to content

Commit cc098ae

Browse files
devin-ai-integration[bot]chdeskurdevalog
authored
Add Copy component documentation (#1868)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Catherine Deskur <[email protected]> Co-authored-by: Devin Logan <[email protected]>
1 parent d98f21b commit cc098ae

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed

.vale/styles/FernStyles/Acronyms.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,4 @@ exceptions:
100100
- FDR
101101
- SSR
102102
- SSG
103+
- REST

fern/products/docs/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ navigation:
6767
path: ./pages/component-library/default-components/code-blocks.mdx
6868
icon: fa-duotone fa-code
6969
slug: code-blocks
70+
- page: Copy
71+
path: ./pages/component-library/default-components/copy.mdx
72+
icon: fa-duotone fa-copy
7073
- page: Download
7174
path: ./pages/component-library/default-components/download.mdx
7275
icon: fa-duotone fa-download
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## New Copy component for inline copyable text
2+
3+
The `<Copy>` component makes text copyable with a single click. Use it inline to allow readers to quickly copy version numbers, commands, API keys, or other text snippets without selecting and copying manually.
4+
5+
You can also customize what gets copied to the clipboard using the `clipboard` prop. This is useful when you want simplify commands, versions, or URLs for readability while copying complete values.
6+
7+
```jsx Markdown
8+
Use the Fern CLI to build and consume REST APIs. The latest version is
9+
<Copy>v2.0</Copy>.
10+
```
11+
12+
Read more in the [Copy component documentation](/learn/docs/writing-content/components/copy).
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Copy
3+
description: Make text copyable with a click-to-copy button.
4+
---
5+
6+
The `<Copy>` component makes text copyable with a single click. Use it inline to allow readers to copy version numbers, commands, API keys, or other text snippets without selecting and copying manually.
7+
8+
## Usage
9+
10+
<div className="highlight-frame">
11+
<div className="highlight-frame-content">
12+
Use the Fern CLI to build and consume REST APIs. The current version is <Copy>v2.0</Copy>.
13+
</div>
14+
</div>
15+
16+
```jsx Markdown
17+
Use the Fern CLI to build and consume REST APIs. The current version is <Copy>v2.0</Copy>.
18+
```
19+
20+
## Variants
21+
22+
### Custom clipboard content
23+
24+
Use the `clipboard` prop to display one value while copying a different value to the clipboard This is useful when you want simplify commands, versions, or URLs for readability while copying complete values.
25+
26+
<div className="highlight-frame">
27+
<div className="highlight-frame-content">
28+
Install the CLI using <Copy clipboard="npm install -g bamboo-leaf-cli">npm install</Copy>
29+
</div>
30+
</div>
31+
32+
```jsx Markdown
33+
Install the CLI using <Copy clipboard="npm install -g bamboo-leaf-cli">npm install</Copy>
34+
```
35+
36+
## Properties
37+
38+
<ParamField path="children" type="string | ReactNode" required={true}>
39+
The text content to display and make copyable. This is what users see on the page.
40+
</ParamField>
41+
42+
<ParamField path="clipboard" type="string" required={false}>
43+
Custom text to copy to the clipboard. Use this when you want to display one value but copy a different value.
44+
</ParamField>

fern/products/docs/pages/component-library/default-components/overview.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Components overview'
33
description: 'Built-in components for creating interactive documentation'
44
---
55

6-
Fern includes 20 built-in components for creating interactive documentation. Select a component below to view usage examples and configuration options.
6+
Fern includes 21 built-in components for creating interactive documentation. Select a component below to view usage examples and configuration options.
77

88
<CardGroup cols={3}>
99
<Card
@@ -62,6 +62,13 @@ Fern includes 20 built-in components for creating interactive documentation. Sel
6262
>
6363
Code examples with syntax highlighting and interactive features
6464
</Card>
65+
<Card
66+
title="Copy"
67+
icon="fa-duotone fa-clipboard"
68+
href="/docs/writing-content/components/copy"
69+
>
70+
Make text copyable with a click-to-copy button
71+
</Card>
6572
<Card
6673
title="Download"
6774
icon="fa-duotone fa-download"

0 commit comments

Comments
 (0)