Debian Codegraph @

node/@patternfly/react-core/src/components/ClipboardCopy/examples/ClipboardCopy.md

raw
1 ---
2 id: Clipboard copy
3 section: components
4 cssPrefix: pf-v6-c-clipboard-copy
5 propComponents: ['ClipboardCopy', 'ClipboardCopyButton']
6 ouia: true
7 ---
8
9 import { Fragment, useEffect, useState } from 'react';
10 import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
11
12 ## Examples
13
14 ### Basic
15
16 ```ts file="./ClipboardCopyBasic.tsx"
17 ```
18
19 ### Read Only
20
21 ```ts file="./ClipboardCopyReadOnly.tsx"
22 ```
23
24 ### Expanded
25
26 ```ts file="./ClipboardCopyExpanded.tsx"
27 ```
28
29 ### Read only expanded
30
31 ```ts file="./ClipboardCopyReadOnlyExpanded.tsx"
32 ```
33
34 ### Read only expanded by default
35
36 ```ts file="./ClipboardCopyReadOnlyExpandedByDefault.tsx"
37 ```
38
39 ### Expanded with array
40
41 ```ts file="./ClipboardCopyExpandedWithArray.tsx"
42 ```
43
44 ### JSON object (wrap code with pre)
45
46 ```ts file="./ClipboardCopyJSONObject.tsx"
47 ```
48
49 ### Inline compact
50
51 ```ts file="./ClipboardCopyInlineCompact.tsx"
52 ```
53
54 ### Inline compact code
55
56 ```ts file="./ClipboardCopyInlineCompactCode.tsx"
57 ```
58
59 ### Inline compact with additional action
60
61 ```ts file="./ClipboardCopyInlineCompactWithAdditionalAction.tsx"
62 ```
63
64 ### Inline compact in sentence
65
66 ```ts file="./ClipboardCopyInlineCompactInSentence.tsx"
67 ```
68
69 ### Inline compact with truncation
70
71 You can control the truncation for an `inline-compact` variant by passing the `truncation` property. The following example shows the different ways to use the property: passing a boolean will apply default truncation, while passing an object of `TruncateProps` offers more fine-tuned control over the truncation behavior.
72
73 ```ts file="./ClipboardCopyInlineCompactTruncation.tsx"
74 ```