Input Copyable
vinkas-ui/input-copyableFreeComponent
An Input component that has copy button which copies the value to clipboard
Live preview
live · rendered by the registry
Rendered by vinkas-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.vinkas.com/r/input-copyable.jsonSource
1"use client"23import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@/components/ui/input-group"4import { Check, Copy } from "lucide-react"5import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"6import { useCopyToClipboard } from "usehooks-ts"78type InputCopyableProps = {9 value: string10} & React.ComponentProps<typeof InputGroup>1112export function InputCopyable(props: InputCopyableProps) {13 const [copied, copy] = useCopyToClipboard()1415 const CopyButton = ({ copied }: { copied: string | null }) => {16 if (copied) {17 return (18 <Tooltip defaultOpen={true}>19 <TooltipTrigger render={<Check />} />20 <TooltipContent>Copied!</TooltipContent>21 </Tooltip>22 )23 }2425 return (26 <Tooltip>27 <TooltipTrigger render={<Copy />} />28 <TooltipContent>Copy</TooltipContent>29 </Tooltip>30 )31 }3233 return (34 <InputGroup {...props}>35 <InputGroupInput value={props.value} readOnly className="overflow-ellipsis" />36 <InputGroupAddon align="inline-end">37 <InputGroupButton38 aria-label="Copy"39 title="Copy"40 size="icon-xs"41 onClick={() => {42 copy(props.value)43 }}44 >45 <CopyButton copied={copied} />46 </InputGroupButton>47 </InputGroupAddon>48 </InputGroup>49 )50}
What it pulls in
npm packages
Other registry items
Files it writes
More from vinkas-ui
All 7 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Copyright Textcopyright-text | vinkas-ui | Components | Free | no deps | |
| Markdown Textmarkdown-text | vinkas-ui | Components | Free | 1 dep | |
| Relative Timerelative-time | vinkas-ui | Components | Free | no deps · 2 files | |
| UTM Linkutm-link | vinkas-ui | Components | Free | no deps |
