Debian Codegraph @

node/@patternfly/patternfly/docs/components/ClipboardCopy/examples/ClipboardCopy.md

raw
1 ---
2 id: Clipboard copy
3 section: components
4 cssPrefix: pf-v6-c-clipboard-copy
5 ---## Examples
6
7 ### Basic
8
9 ```html
10 <div class="pf-v6-c-clipboard-copy">
11 <div class="pf-v6-c-clipboard-copy__group">
12 <span class="pf-v6-c-form-control">
13 <input
14 type="text"
15 value="This is editable"
16 id="basic-editable-text-input"
17 aria-label="Copyable input"
18 />
19 </span>
20 <button
21 class="pf-v6-c-button pf-m-control"
22 id="basic-editable-copy-button"
23 type="button"
24 aria-label="Copy to clipboard basic editable example"
25 >
26 <span class="pf-v6-c-button__icon">
27 <svg
28 class="pf-v6-svg"
29 fill="currentColor"
30 viewBox="0 0 32 32"
31 aria-hidden="true"
32 role="img"
33 width="1em"
34 height="1em"
35 >
36 <path
37 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
38 />
39 </svg>
40 </span>
41 </button>
42 </div>
43 </div>
44 <br />
45 <div class="pf-v6-c-clipboard-copy pf-m-readonly">
46 <div class="pf-v6-c-clipboard-copy__group">
47 <span class="pf-v6-c-form-control pf-m-readonly">
48 <input
49 readonly
50 type="text"
51 value="This is read-only"
52 id="basic-readonly-text-input"
53 aria-label="Copyable input"
54 />
55 </span>
56 <button
57 class="pf-v6-c-button pf-m-control"
58 id="basic-readonly-copy-button"
59 type="button"
60 aria-label="Copy to clipboard basic read-only example"
61 >
62 <span class="pf-v6-c-button__icon">
63 <svg
64 class="pf-v6-svg"
65 fill="currentColor"
66 viewBox="0 0 32 32"
67 aria-hidden="true"
68 role="img"
69 width="1em"
70 height="1em"
71 >
72 <path
73 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
74 />
75 </svg>
76 </span>
77 </button>
78 </div>
79 </div>
80
81 ```
82
83 ### Expandable
84
85 ```html
86 <h4>Editable</h4>
87 <div class="pf-v6-c-clipboard-copy">
88 <div class="pf-v6-c-clipboard-copy__group">
89 <button
90 class="pf-v6-c-button pf-m-control"
91 type="button"
92 aria-expanded="false"
93 id="expandable-not-expanded-editable-toggle"
94 aria-label="Toggle unexpanded editable example"
95 aria-controls="expandable-not-expanded-editable-content"
96 >
97 <span class="pf-v6-c-button__icon">
98 <div class="pf-v6-c-clipboard-copy__toggle-icon">
99 <svg
100 class="pf-v6-svg"
101 fill="currentColor"
102 viewBox="0 0 20 20"
103 aria-hidden="true"
104 role="img"
105 width="1em"
106 height="1em"
107 >
108 <path
109 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
110 />
111 </svg>
112 </div>
113 </span>
114 </button>
115 <span class="pf-v6-c-form-control">
116 <input
117 type="text"
118 value="This is an editable version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion."
119 id="expandable-not-expanded-editable-text-input"
120 aria-label="Copyable input"
121 />
122 </span>
123 <button
124 class="pf-v6-c-button pf-m-control"
125 type="button"
126 aria-label="Copy to clipboard unexpanded editable example"
127 id="expandable-not-expanded-editable-copy-button"
128 >
129 <span class="pf-v6-c-button__icon">
130 <svg
131 class="pf-v6-svg"
132 fill="currentColor"
133 viewBox="0 0 32 32"
134 aria-hidden="true"
135 role="img"
136 width="1em"
137 height="1em"
138 >
139 <path
140 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
141 />
142 </svg>
143 </span>
144 </button>
145 </div>
146 <div
147 class="pf-v6-c-clipboard-copy__expandable-content"
148 hidden
149 id="expandable-not-expanded-editable-content"
150 >This is an editable version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion.</div>
151 </div>
152 <br />
153 <div class="pf-v6-c-clipboard-copy pf-m-expanded">
154 <div class="pf-v6-c-clipboard-copy__group">
155 <button
156 class="pf-v6-c-button pf-m-control"
157 type="button"
158 aria-expanded="true"
159 id="expandable-expanded-editable-toggle"
160 aria-label="Toggle expanded editable example"
161 aria-controls="expandable-expanded-editable-content"
162 >
163 <span class="pf-v6-c-button__icon">
164 <div class="pf-v6-c-clipboard-copy__toggle-icon">
165 <svg
166 class="pf-v6-svg"
167 fill="currentColor"
168 viewBox="0 0 20 20"
169 aria-hidden="true"
170 role="img"
171 width="1em"
172 height="1em"
173 >
174 <path
175 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
176 />
177 </svg>
178 </div>
179 </span>
180 </button>
181 <span class="pf-v6-c-form-control pf-m-readonly">
182 <input
183 readonly
184 type="text"
185 value="This is an editable version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion."
186 id="expandable-expanded-editable-text-input"
187 aria-label="Copyable input"
188 />
189 </span>
190 <button
191 class="pf-v6-c-button pf-m-control"
192 type="button"
193 aria-label="Copy to clipboard expanded editable example"
194 id="expandable-expanded-editable-copy-button"
195 >
196 <span class="pf-v6-c-button__icon">
197 <svg
198 class="pf-v6-svg"
199 fill="currentColor"
200 viewBox="0 0 32 32"
201 aria-hidden="true"
202 role="img"
203 width="1em"
204 height="1em"
205 >
206 <path
207 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
208 />
209 </svg>
210 </span>
211 </button>
212 </div>
213 <div
214 class="pf-v6-c-clipboard-copy__expandable-content"
215 contenteditable="true"
216 id="expandable-expanded-editable-content"
217 >This is an editable version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion.</div>
218 </div>
219 <br />
220 <h4>Read-only</h4>
221 <div class="pf-v6-c-clipboard-copy pf-m-readonly">
222 <div class="pf-v6-c-clipboard-copy__group">
223 <button
224 class="pf-v6-c-button pf-m-control"
225 type="button"
226 aria-expanded="false"
227 id="expandable-not-expanded-readonly-toggle"
228 aria-label="Toggle read-only unexpanded example"
229 aria-controls="expandable-not-expanded-readonly-content"
230 >
231 <span class="pf-v6-c-button__icon">
232 <div class="pf-v6-c-clipboard-copy__toggle-icon">
233 <svg
234 class="pf-v6-svg"
235 fill="currentColor"
236 viewBox="0 0 20 20"
237 aria-hidden="true"
238 role="img"
239 width="1em"
240 height="1em"
241 >
242 <path
243 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
244 />
245 </svg>
246 </div>
247 </span>
248 </button>
249 <span class="pf-v6-c-form-control pf-m-readonly">
250 <input
251 readonly
252 type="text"
253 value="This is a read-only version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion."
254 id="expandable-not-expanded-readonly-text-input"
255 aria-label="Copyable input"
256 />
257 </span>
258 <button
259 class="pf-v6-c-button pf-m-control"
260 type="button"
261 aria-label="Copy to clipboard read-only collapsed example"
262 id="expandable-not-expanded-readonly-copy-button"
263 >
264 <span class="pf-v6-c-button__icon">
265 <svg
266 class="pf-v6-svg"
267 fill="currentColor"
268 viewBox="0 0 32 32"
269 aria-hidden="true"
270 role="img"
271 width="1em"
272 height="1em"
273 >
274 <path
275 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
276 />
277 </svg>
278 </span>
279 </button>
280 </div>
281 <div
282 class="pf-v6-c-clipboard-copy__expandable-content"
283 hidden
284 id="expandable-not-expanded-readonly-content"
285 >This is an editable version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion.</div>
286 </div>
287 <br />
288 <div class="pf-v6-c-clipboard-copy pf-m-expanded pf-m-readonly">
289 <div class="pf-v6-c-clipboard-copy__group">
290 <button
291 class="pf-v6-c-button pf-m-control"
292 type="button"
293 aria-expanded="true"
294 id="expandable-expanded-readonly-toggle"
295 aria-label="Toggle read-only expanded example"
296 aria-controls="expandable-expanded-readonly-content"
297 >
298 <span class="pf-v6-c-button__icon">
299 <div class="pf-v6-c-clipboard-copy__toggle-icon">
300 <svg
301 class="pf-v6-svg"
302 fill="currentColor"
303 viewBox="0 0 20 20"
304 aria-hidden="true"
305 role="img"
306 width="1em"
307 height="1em"
308 >
309 <path
310 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
311 />
312 </svg>
313 </div>
314 </span>
315 </button>
316 <span class="pf-v6-c-form-control pf-m-readonly">
317 <input
318 readonly
319 type="text"
320 value="This is a read-only version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion."
321 id="expandable-expanded-readonly-text-input"
322 aria-label="Copyable input"
323 />
324 </span>
325 <button
326 class="pf-v6-c-button pf-m-control"
327 type="button"
328 aria-label="Copy to clipboard read-only expanded example"
329 id="expandable-expanded-readonly-copy-button"
330 >
331 <span class="pf-v6-c-button__icon">
332 <svg
333 class="pf-v6-svg"
334 fill="currentColor"
335 viewBox="0 0 32 32"
336 aria-hidden="true"
337 role="img"
338 width="1em"
339 height="1em"
340 >
341 <path
342 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
343 />
344 </svg>
345 </span>
346 </button>
347 </div>
348 <div
349 class="pf-v6-c-clipboard-copy__expandable-content"
350 id="expandable-expanded-readonly-content"
351 >This is a read-only version of the copy to clipboard component that has an expandable section. Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting expansion.</div>
352 </div>
353 <br />
354 <h4>Code</h4>
355 <div class="pf-v6-c-clipboard-copy">
356 <div class="pf-v6-c-clipboard-copy__group">
357 <button
358 class="pf-v6-c-button pf-m-control"
359 type="button"
360 aria-expanded="false"
361 id="expandable-not-expanded-code-toggle"
362 aria-label="Toggle code unexpanded example"
363 aria-controls="expandable-not-expanded-code-content"
364 >
365 <span class="pf-v6-c-button__icon">
366 <div class="pf-v6-c-clipboard-copy__toggle-icon">
367 <svg
368 class="pf-v6-svg"
369 fill="currentColor"
370 viewBox="0 0 20 20"
371 aria-hidden="true"
372 role="img"
373 width="1em"
374 height="1em"
375 >
376 <path
377 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
378 />
379 </svg>
380 </div>
381 </span>
382 </button>
383 <span class="pf-v6-c-form-control">
384 <input
385 dir="ltr"
386 type="text"
387 value="{ &quot;menu&quot;: { &quot;id&quot;: &quot;file&quot;, &quot;value&quot;: &quot;File&quot;, &quot;popup&quot;: { &quot;menuitem&quot;: [ {&quot;value&quot;: &quot;New&quot;, &quot;onclick&quot;: &quot;CreateNewDoc()&quot;}, {&quot;value&quot;: &quot;Open&quot;, &quot;onclick&quot;: &quot;OpenDoc()&quot;}, {&quot;value&quot;: &quot;Close&quot;, &quot;onclick&quot;: &quot;CloseDoc()&quot;} ] } }} "
388 id="expandable-not-expanded-code-text-input"
389 aria-label="Copyable input"
390 />
391 </span>
392 <button
393 class="pf-v6-c-button pf-m-control"
394 type="button"
395 aria-label="Copy to clipboard code unexpanded example"
396 id="expandable-not-expanded-code-copy-button"
397 >
398 <span class="pf-v6-c-button__icon">
399 <svg
400 class="pf-v6-svg"
401 fill="currentColor"
402 viewBox="0 0 32 32"
403 aria-hidden="true"
404 role="img"
405 width="1em"
406 height="1em"
407 >
408 <path
409 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
410 />
411 </svg>
412 </span>
413 </button>
414 </div>
415 <div
416 class="pf-v6-c-clipboard-copy__expandable-content"
417 hidden
418 id="expandable-not-expanded-code-content"
419 >
420 <pre dir="ltr">{ "menu": {
421 "id": "file",
422 "value": "File",
423 "popup": {
424 "menuitem": [
425 {"value": "New", "onclick": "CreateNewDoc()"},
426 {"value": "Open", "onclick": "OpenDoc()"},
427 {"value": "Close", "onclick": "CloseDoc()"}
428 ]
429 }
430 }}
431 </pre>
432 </div>
433 </div>
434 <br />
435 <div class="pf-v6-c-clipboard-copy pf-m-expanded">
436 <div class="pf-v6-c-clipboard-copy__group">
437 <button
438 class="pf-v6-c-button pf-m-control"
439 type="button"
440 aria-expanded="true"
441 id="expandable-expanded-code-toggle"
442 aria-label="Toggle code expanded example"
443 aria-controls="expandable-expanded-code-content"
444 >
445 <span class="pf-v6-c-button__icon">
446 <div class="pf-v6-c-clipboard-copy__toggle-icon">
447 <svg
448 class="pf-v6-svg"
449 fill="currentColor"
450 viewBox="0 0 20 20"
451 aria-hidden="true"
452 role="img"
453 width="1em"
454 height="1em"
455 >
456 <path
457 d="M18.71 5.29a.996.996 0 0 0-1.41 0l-7.29 7.29-7.3-7.29a.987.987 0 0 0-1.41-.02.987.987 0 0 0-.02 1.41l.02.02 7.65 7.65c.29.29.68.44 1.06.44s.77-.15 1.06-.44l7.65-7.65a.996.996 0 0 0 0-1.41Z"
458 />
459 </svg>
460 </div>
461 </span>
462 </button>
463 <span class="pf-v6-c-form-control pf-m-readonly">
464 <input
465 readonly
466 dir="ltr"
467 type="text"
468 value="{ &quot;menu&quot;: { &quot;id&quot;: &quot;file&quot;, &quot;value&quot;: &quot;File&quot;, &quot;popup&quot;: { &quot;menuitem&quot;: [ {&quot;value&quot;: &quot;New&quot;, &quot;onclick&quot;: &quot;CreateNewDoc()&quot;}, {&quot;value&quot;: &quot;Open&quot;, &quot;onclick&quot;: &quot;OpenDoc()&quot;}, {&quot;value&quot;: &quot;Close&quot;, &quot;onclick&quot;: &quot;CloseDoc()&quot;} ] } }} "
469 id="expandable-expanded-code-text-input"
470 aria-label="Copyable input"
471 />
472 </span>
473 <button
474 class="pf-v6-c-button pf-m-control"
475 type="button"
476 aria-label="Copy to clipboard code expanded example"
477 id="expandable-expanded-code-copy-button"
478 >
479 <span class="pf-v6-c-button__icon">
480 <svg
481 class="pf-v6-svg"
482 fill="currentColor"
483 viewBox="0 0 32 32"
484 aria-hidden="true"
485 role="img"
486 width="1em"
487 height="1em"
488 >
489 <path
490 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
491 />
492 </svg>
493 </span>
494 </button>
495 </div>
496 <div
497 class="pf-v6-c-clipboard-copy__expandable-content"
498 contenteditable="true"
499 id="expandable-expanded-code-content"
500 >
501 <pre dir="ltr">{ "menu": {
502 "id": "file",
503 "value": "File",
504 "popup": {
505 "menuitem": [
506 {"value": "New", "onclick": "CreateNewDoc()"},
507 {"value": "Open", "onclick": "OpenDoc()"},
508 {"value": "Close", "onclick": "CloseDoc()"}
509 ]
510 }
511 }}
512 </pre>
513 </div>
514 </div>
515
516 ```
517
518 ### Inline compact
519
520 ```html
521 <div class="pf-v6-c-clipboard-copy pf-m-inline">
522 <span class="pf-v6-c-clipboard-copy__text">2.3.4-2-redhat</span>
523 <span class="pf-v6-c-clipboard-copy__actions">
524 <span class="pf-v6-c-clipboard-copy__actions-item">
525 <button
526 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
527 type="button"
528 aria-label="Copy to clipboard inline compact example"
529 >
530 <span class="pf-v6-c-button__icon">
531 <svg
532 class="pf-v6-svg"
533 fill="currentColor"
534 viewBox="0 0 32 32"
535 aria-hidden="true"
536 role="img"
537 width="1em"
538 height="1em"
539 >
540 <path
541 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
542 />
543 </svg>
544 </span>
545 </button>
546 </span>
547 </span>
548 </div>
549
550 ```
551
552 ### Inline compact code
553
554 ```html
555 <div class="pf-v6-c-clipboard-copy pf-m-inline">
556 <code class="pf-v6-c-clipboard-copy__text pf-m-code">2.3.4-2-redhat</code>
557 <span class="pf-v6-c-clipboard-copy__actions">
558 <span class="pf-v6-c-clipboard-copy__actions-item">
559 <button
560 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
561 type="button"
562 aria-label="Copy to clipboard inline compact code example"
563 >
564 <span class="pf-v6-c-button__icon">
565 <svg
566 class="pf-v6-svg"
567 fill="currentColor"
568 viewBox="0 0 32 32"
569 aria-hidden="true"
570 role="img"
571 width="1em"
572 height="1em"
573 >
574 <path
575 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
576 />
577 </svg>
578 </span>
579 </button>
580 </span>
581 </span>
582 </div>
583
584 ```
585
586 ### Inline compact with additional action
587
588 ```html
589 <div class="pf-v6-c-clipboard-copy pf-m-inline">
590 <span class="pf-v6-c-clipboard-copy__text">2.3.4-2-redhat</span>
591 <span class="pf-v6-c-clipboard-copy__actions">
592 <span class="pf-v6-c-clipboard-copy__actions-item">
593 <button
594 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
595 type="button"
596 aria-label="Copy to clipboard inline compact with additional action example"
597 >
598 <span class="pf-v6-c-button__icon">
599 <svg
600 class="pf-v6-svg"
601 fill="currentColor"
602 viewBox="0 0 32 32"
603 aria-hidden="true"
604 role="img"
605 width="1em"
606 height="1em"
607 >
608 <path
609 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
610 />
611 </svg>
612 </span>
613 </button>
614 </span>
615 <span class="pf-v6-c-clipboard-copy__actions-item">
616 <button
617 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
618 type="button"
619 aria-label="Run in web terminal"
620 >
621 <span class="pf-v6-c-button__icon">
622 <svg
623 class="pf-v6-svg"
624 fill="currentColor"
625 viewBox="0 0 32 32"
626 aria-hidden="true"
627 role="img"
628 width="1em"
629 height="1em"
630 >
631 <path
632 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
633 />
634 </svg>
635 </span>
636 </button>
637 </span>
638 </span>
639 </div>
640
641 ```
642
643 ### Inline compact in sentence
644
645 ```html
646 <h4>
647 <strong>Basic</strong>
648 </h4>Lorem ipsum&nbsp;
649 <div class="pf-v6-c-clipboard-copy pf-m-inline">
650 <span class="pf-v6-c-clipboard-copy__text">2.3.4-2-redhat</span>
651 <span class="pf-v6-c-clipboard-copy__actions">
652 <span class="pf-v6-c-clipboard-copy__actions-item">
653 <button
654 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
655 type="button"
656 aria-label="Copy to clipboard basic inline compact example"
657 >
658 <span class="pf-v6-c-button__icon">
659 <svg
660 class="pf-v6-svg"
661 fill="currentColor"
662 viewBox="0 0 32 32"
663 aria-hidden="true"
664 role="img"
665 width="1em"
666 height="1em"
667 >
668 <path
669 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
670 />
671 </svg>
672 </span>
673 </button>
674 </span>
675 </span>
676 </div>
677 &nbsp;dolor sit amet.
678 <br />
679 <br />
680
681 <h4>
682 <strong>Long copy string</strong>
683 </h4>Lorem ipsum dolor sit amet, consectetur adipiscing elit.&nbsp;
684 <div class="pf-v6-c-clipboard-copy pf-m-inline">
685 <span
686 class="pf-v6-c-clipboard-copy__text"
687 >https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890</span>
688 <span class="pf-v6-c-clipboard-copy__actions">
689 <span class="pf-v6-c-clipboard-copy__actions-item">
690 <button
691 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
692 type="button"
693 aria-label="Copy to clipboard long inline compact example"
694 >
695 <span class="pf-v6-c-button__icon">
696 <svg
697 class="pf-v6-svg"
698 fill="currentColor"
699 viewBox="0 0 32 32"
700 aria-hidden="true"
701 role="img"
702 width="1em"
703 height="1em"
704 >
705 <path
706 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
707 />
708 </svg>
709 </span>
710 </button>
711 </span>
712 </span>
713 </div>&nbsp;Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
714 <br />
715 <br />
716
717 <h4>
718 <strong>Long copy string in block</strong>
719 </h4>Lorem ipsum dolor sit amet, consectetur adipiscing elit.&nbsp;
720 <div class="pf-v6-c-clipboard-copy pf-m-inline pf-m-block">
721 <span
722 class="pf-v6-c-clipboard-copy__text"
723 >https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890</span>
724 <span class="pf-v6-c-clipboard-copy__actions">
725 <span class="pf-v6-c-clipboard-copy__actions-item">
726 <button
727 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
728 type="button"
729 aria-label="Copy to clipboard long block compact example"
730 >
731 <span class="pf-v6-c-button__icon">
732 <svg
733 class="pf-v6-svg"
734 fill="currentColor"
735 viewBox="0 0 32 32"
736 aria-hidden="true"
737 role="img"
738 width="1em"
739 height="1em"
740 >
741 <path
742 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
743 />
744 </svg>
745 </span>
746 </button>
747 </span>
748 </span>
749 </div>&nbsp;Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
750
751 ```
752
753 ### Inline compact with truncation
754
755 ```html
756 <div class="pf-v6-c-clipboard-copy pf-m-inline pf-m-truncate">
757 <span class="pf-v6-c-clipboard-copy__text">
758 <span class="pf-v6-c-truncate" tabindex="0">
759 <span
760 class="pf-v6-c-truncate__start"
761 >This lengthy, copyable content will be truncated with default settings when the truncation prop is simply set to true. This is useful for quickly applying truncation without needing to worry about any other properties to set.</span>
762 </span>
763 </span>
764 <span class="pf-v6-c-clipboard-copy__actions">
765 <span class="pf-v6-c-clipboard-copy__actions-item">
766 <button
767 class="pf-v6-c-button pf-m-no-padding pf-m-plain"
768 type="button"
769 aria-label="Copy to clipboard inline compact with truncation example"
770 >
771 <span class="pf-v6-c-button__icon">
772 <svg
773 class="pf-v6-svg"
774 fill="currentColor"
775 viewBox="0 0 32 32"
776 aria-hidden="true"
777 role="img"
778 width="1em"
779 height="1em"
780 >
781 <path
782 d="M28 7v22.607c0 .768-.622 1.393-1.387 1.393H10a1 1 0 1 1 0-2h16V7a1 1 0 1 1 2 0Zm-5.25 17.5v-22c0-.689-.561-1.25-1.25-1.25h-8.375v7.364c0 .833-.678 1.511-1.512 1.511H4.25V24.5c0 .689.561 1.25 1.25 1.25h16c.689 0 1.25-.561 1.25-1.25ZM10.875 1.275a.738.738 0 0 0-.405.195l-6 6a.738.738 0 0 0-.195.405h6.6v-6.6Z"
783 />
784 </svg>
785 </span>
786 </button>
787 </span>
788 </span>
789 </div>
790
791 ```
792
793 ## Documentation
794
795 ### Accessibility
796
797 | Attribute | Applied to | Outcome |
798 | -- | -- | -- |
799 | `aria-label="Copy to clipboard"`, `aria-label="Show content"` | `.pf-v6-c-button.pf-m-control` | Provides an accessible name for the button when an icon is used instead of text. **Required when an icon is used with no supporting text.** |
800 | `aria-label="[input label text]"` | `.pf-v6-c-form-control` | Provides an accessible label for the input. Provide a label that describes the contents in the input. **Required** |
801 | `aria-hidden="true"` | `<i>` | Hides the icon from assistive technologies. |
802 | `aria-controls="[id of expandable element]"` | `.pf-v6-c-button.pf-m-control` | Identifies the element controlled by the toggle button. **Required** |
803 | `hidden` | `.pf-v6-c-clipboard-copy__expandable-content` | Indicates that the expandable content is hidden so that it isn't visible in the UI and isn't accessed by assistive technologies. |
804 | `aria-labelledby="[id of button] [id of input label]"` | `.pf-v6-c-button.pf-m-control` | Provides an accessible name that is unique and communicates context of the button. Required when more than one ClipboardCopy component exists on the page. **Important:** If the label is defined on the `<input>` using `aria-label`, then use the `id` of the `<input>`. If the label is defined in a `<label>`, then use the `id` of the `<label>`. **Alternatively** this attribute can be ignored if the text input label is defined as part of the value in `aria-label`. |
805
806 ### Usage
807
808 | Class | Applied to | Outcome |
809 | -- | -- | -- |
810 | `.pf-v6-c-clipboard-copy` | `<div>` | Initiates a clipboard copy component. **Required** |
811 | `.pf-v6-c-clipboard-copy__group` | `<div>` | Initiates a wrapper for the clipboard copy group. **Required** |
812 | `.pf-v6-c-clipboard-copy__toggle-icon` | `<div>` | Initiates a toggle button icon. |
813 | `.pf-v6-c-clipboard-copy__expandable-content` | `<div>` | Initiates an expandable element. |
814 | `.pf-v6-c-clipboard-copy__text` | `<span>` | Initiates the inline copy clipboard text element. **Required** |
815 | `.pf-v6-c-clipboard-copy__actions` | `<span>` | Initiates the inline copy clipboard actions element. **Required** |
816 | `.pf-v6-c-clipboard-copy__actions-item` | `<span>` | Initiates the inline copy clipboard actions item element. **Required** |
817 | `.pf-m-inline` | `.pf-v6-c-clipboard-copy` | Modifies the clipboard copy component for inline styles. |
818 | `.pf-m-block` | `.pf-v6-c-clipboard-copy.pf-m-inline` | Modifies the inline copy clipboard component to have block formatting. |
819 | `.pf-m-truncate` | `.pf-v6-c-clipboard-copy.pf-m-truncate` | Modifies the inline copy clipboard component for use with text used in trucate component. |
820 | `.pf-m-expanded` | `.pf-v6-c-clipboard-copy` | Modifies the clipboard copy component for the expanded state. |
821 | `.pf-m-readonly` | `.pf-v6-c-clipboard-copy` | Modifies the clipboard copy component for read-only styles. |
822 | `.pf-m-expanded` | `.pf-v6-c-button.pf-m-control` | Modifies the control toggle button for the expanded state. |
823 | `.pf-m-code` | `code.pf-v6-c-clipboard-copy__text` | Modifies the inline copy clipboard text styles for use with the `<code>` element. |