BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fluid-functionalism/input-copy

Input Copy

fluid-functionalism/input-copy
FreeComponent

Read-only input with a copy-to-clipboard button and animated check feedback. Supports optional label and shape context.

Install it

npx shadcn@latest add https://fluidfunctionalism.com/r/input-copy.json

Source

registry/default/input-copy.tsxfluidfunctionalism.com/r/input-copy.json · first 6 KB
1"use client";
2
3import { forwardRef, useState, useCallback, useRef, useEffect, useId, type HTMLAttributes } from "react";
4import { motion, AnimatePresence } from "framer-motion";
5import { cn } from "@/lib/utils";
6import { useIcon } from "@/lib/icon-context";
7import { fontWeights } from "@/lib/font-weight";
8import { useShape } from "@/lib/shape-context";
9import { spring } from "@/lib/springs";
10import { Tooltip } from "@/registry/radix/tooltip";
11
12type InputCopyVariant = "icon" | "button";
13type InputCopyAlign = "right" | "left";
14
15interface InputCopyProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
16 /** The value to display and copy to clipboard. */
17 value: string;
18 /** Optional label displayed above the input. */
19 label?: string;
20 /** Callback fired after the value is copied. */
21 onCopy?: () => void;
22 /** Whether the component is disabled. */
23 disabled?: boolean;
24 /** Display variant: icon-only with tooltip, or button with label. */
25 variant?: InputCopyVariant;
26 /** Position of the copy action relative to the value. */
27 align?: InputCopyAlign;
28}
29
30const InputCopy = forwardRef<HTMLDivElement, InputCopyProps>(
31 ({ value, label, onCopy, disabled, variant = "icon", align = "right", className, ...props }, ref) => {
32 const CopyIcon = useIcon("copy");
33 // "copied" and "error" both occupy the same animation slot on the button
34 const [status, setStatus] = useState<"idle" | "copied" | "error">("idle");
35 const [copyCount, setCopyCount] = useState(0);
36 // "idle" = normal tooltip behavior, "copied" = force open, "suppressed" = force closed
37 const [tooltipState, setTooltipState] = useState<"idle" | "copied" | "suppressed">("idle");
38 const timeoutRef = useRef<ReturnType<typeof setTimeout>>(null);
39 const tooltipVisibleRef = useRef(false);
40 const tooltipWasVisibleRef = useRef(false);
41 const shape = useShape();
42
43 // Associate the visible label with the button: the button's accessible
44 // name reads "Copy <label>" (its own state label + the field label).
45 const generatedId = useId();
46 const labelId = label ? `${generatedId}-label` : undefined;
47 const buttonId = `${generatedId}-button`;
48
49 const handlePointerDown = useCallback(() => {
50 // Capture tooltip visibility before Radix closes it on pointer down
51 tooltipWasVisibleRef.current = tooltipVisibleRef.current;
52 }, []);
53
54 // execCommand fallback for when the async Clipboard API is unavailable or
55// … truncated

What it pulls in

npm packages

  • framer-motion
  • lucide-react

Other registry items

  • utils
  • https://www.fluidfunctionalism.com/r/springs.json
  • https://www.fluidfunctionalism.com/r/font-weight.json
  • https://www.fluidfunctionalism.com/r/shape-context.json
  • https://www.fluidfunctionalism.com/r/icon-context.json

Files it writes

  • registry/default/input-copy.tsx

Facts

Registry
fluid-functionalism
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

fluidfunctionalism.com mickadesign/fluid-functionalism on GitHub Raw registry item This item as JSON

More from fluid-functionalism

All 53 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionfluid-functionalismComponentsFree3 deps
Accordion (Base UI)accordion-basefluid-functionalismComponentsFree3 deps
Ask User Questionsask-user-questionsfluid-functionalismComponentsFree2 deps
Badgebadgefluid-functionalismComponentsFree1 dep
Buttonbuttonfluid-functionalismComponentsFree4 deps
Button (Base UI)button-basefluid-functionalismComponentsFree4 deps
Cardcardfluid-functionalismComponentsFree1 dep
Chat Messagechat-messagefluid-functionalismComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex