Skip to content

Copy Box ​

Stable

Compose read-only text box & Copy button into Copy box

vue
<script setup lang="ts">
import { HCopyBox } from '@holistics/design-system'

const text = 'Text to be copied'
const name = 'Example Copy Box'
</script>
<template>
  <HCopyBox
    :name
    :text
  />
</template>

Examples ​

Additional Button ​

vue
<script setup lang="ts">
import { HCopyBox, HButton } from '@holistics/design-system'

const text = 'Text to be copied'
const name = 'Example Copy Box'
</script>
<template>
  <HCopyBox
    :name
    :text
  >
    <template #additionalButtons>
      <HButton
        type="tertiary-default"
        icon="redo"
        size="md"
        unified
      />
    </template>
  </HCopyBox>
</template>

Multi-line ​

vue
<script setup lang="ts">
import { HCopyBox } from '@holistics/design-system'

const text = `Lorem ipsum dolor sit amet consectetur adipiscing elit.
    Consectetur adipiscing elit quisque faucibus ex sapien vitae.
    Ex sapien vitae pellentesque sem placerat in id.
    Placerat in id cursus mi pretium tellus duis.
    Pretium tellus duis convallis tempus leo eu aenean.`
const name = 'Example Copy Box'
</script>
<template>
  <HCopyBox
    :name
    :text
    multiline
  >
    <template #additionalButtons>
      <HButton
        type="secondary-default"
        icon="redo"
        size="md"
        unified
      />
    </template>
  </HCopyBox>
</template>

API ​

Pass-through: <div> ​

What does this mean?

All props, events, and attrs that are not specified in the tables below will be passed to the element/component described above.

Props ​

NameTypeDescription
text 
string
= ""
autoSelect 
boolean
selectOnClick 
boolean
= true
name 
string
= ""
textClass 
string
= ""
hideCopyBtn 
boolean
customCopyText 
string
multiline 
boolean
= false

Events ​

NameParametersDescription
@copied
[content: string]

Slots ​

NameScopedDescription
#default
{ text: string; }
#additionalButtons
{}
#copy-button-content
{ showText: boolean; copyText: () => Promise<void>; }