use-copy-to-clipboard.ts — ui Source File
Architecture documentation for use-copy-to-clipboard.ts, a typescript file in the ui codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7ac47faf_ec86_a724_0046_b9bb3cf05458["use-copy-to-clipboard.ts"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 7ac47faf_ec86_a724_0046_b9bb3cf05458 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 style 7ac47faf_ec86_a724_0046_b9bb3cf05458 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
export function useCopyToClipboard({
timeout = 2000,
onCopy,
}: {
timeout?: number
onCopy?: () => void
} = {}) {
const [isCopied, setIsCopied] = React.useState(false)
const copyToClipboard = (value: string) => {
if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
return
}
if (!value) return
navigator.clipboard.writeText(value).then(() => {
setIsCopied(true)
if (onCopy) {
onCopy()
}
setTimeout(() => {
setIsCopied(false)
}, timeout)
}, console.error)
}
return { isCopied, copyToClipboard }
}
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does use-copy-to-clipboard.ts do?
use-copy-to-clipboard.ts is a source file in the ui codebase, written in typescript. It belongs to the ComponentRegistry domain, Styles subdomain.
What functions are defined in use-copy-to-clipboard.ts?
use-copy-to-clipboard.ts defines 1 function(s): useCopyToClipboard.
What does use-copy-to-clipboard.ts depend on?
use-copy-to-clipboard.ts imports 1 module(s): react.
Where is use-copy-to-clipboard.ts in the architecture?
use-copy-to-clipboard.ts is located at deprecated/www/hooks/use-copy-to-clipboard.ts (domain: ComponentRegistry, subdomain: Styles, directory: deprecated/www/hooks).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free