Castle logo

CASTLE UI

search

Search

K
hexagon

useClipboard is a custom hook that handles copying content to clipboard.

Arguments

The useClipboard hook takes the following arguments:

NameTypeRequiredDescription
textstringtrueThe text or value that is to be copied.
optionsOrTimeoutnumber or objectfalseThe timeout as a number or an object containing 2 properties: timeout and format for the MIME type

Return value

The useClipboard hook returns an object with the following fields:

NameTypeDefaultDescription
valuestringThe copied value.
onCopyfunctionCallback function to copy content.
hasCopiedbooleanfalseIf true, the content has been copied .

Import

import { useClipboard } from '@passfort/castle'
content_copy

Copy

Usage

content_copy

Copy

live example

Contents