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-message

Input Message

fluid-functionalism/input-message
FreeComponent

Chat-style message composer with auto-resizing textarea, drag-and-drop file attachments (PNG / JPEG / PDF), flexible left/right action slots, and a built-in send button on a Surface-2 substrate.

Install it

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

Source

registry/default/input-message.tsxfluidfunctionalism.com/r/input-message.json · first 6 KB
1"use client";
2
3import {
4 forwardRef,
5 useCallback,
6 useEffect,
7 useLayoutEffect,
8 useMemo,
9 useRef,
10 useState,
11 type ChangeEvent,
12 type DragEvent as ReactDragEvent,
13 type HTMLAttributes,
14 type KeyboardEvent as ReactKeyboardEvent,
15 type ReactNode,
16 type TextareaHTMLAttributes,
17} from "react";
18import { AnimatePresence, motion, Reorder, useReducedMotion } from "framer-motion";
19import { cn } from "@/lib/utils";
20import { fontWeights } from "@/lib/font-weight";
21import { spring } from "@/lib/springs";
22import { useShape } from "@/lib/shape-context";
23import { useIcon } from "@/lib/icon-context";
24import { surfaceClasses } from "@/lib/surface-classes";
25import { SurfaceProvider } from "@/lib/surface-context";
26import { FileThumbnail } from "@/registry/default/file-thumbnail";
27import { Button } from "@/registry/radix/button";
28import { Tooltip } from "@/registry/radix/tooltip";
29
30const useIsoLayoutEffect =
31 typeof window !== "undefined" ? useLayoutEffect : useEffect;
32
33// Touch devices have no hover, so hover-revealed affordances (like a queued
34// row's × button) would never appear. `(hover: none)` flags those so they can
35// be shown persistently instead. SSR-safe: starts false, resolves on mount.
36function useIsTouch() {
37 const [isTouch, setIsTouch] = useState(false);
38 useEffect(() => {
39 const mq = window.matchMedia("(hover: none)");
40 const update = () => setIsTouch(mq.matches);
41 update();
42 mq.addEventListener("change", update);
43 return () => mq.removeEventListener("change", update);
44 }, []);
45 return isTouch;
46}
47
48const DEFAULT_ACCEPT = "image/png,image/jpeg,application/pdf";
49
50interface InputMessageSlotContext {
51 /** Opens the native file picker via the hidden `<input type="file">`.
52 * Pass `acceptOverride` (e.g. `"image/*"`) to scope the picker to a
53 * subset of the component's accept types just for this invocation. */
54 openFilePicker: (acceptOverride?: string) => void;
55 /** Currently-attached files (controlled). */
56 files: File[];
57}
58
59type InputMessageSlot =
60 | ReactNode
61 | ((ctx: InputMessageSlotContext) => ReactNode);
62
63/** A message held in the queue while the assistant is responding. Carries the
64 * trimmed text plus a snapshot of the files attached when it was queued, so
65 * double-click-to-edit can restore both. `id` is a stable key minted on enqueue. */
66interface QueuedMessage {
67 id: string;
68 text: string;
69 files: File[];
70}
71
72interface InputMessageProps
73 extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
74// … truncated

What it pulls in

npm packages

  • framer-motion

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
  • https://www.fluidfunctionalism.com/r/surface-context.json
  • https://www.fluidfunctionalism.com/r/surface-classes.json
  • https://www.fluidfunctionalism.com/r/file-thumbnail.json
  • https://www.fluidfunctionalism.com/r/button.json
  • https://www.fluidfunctionalism.com/r/tooltip.json

Files it writes

  • registry/default/input-message.tsx

Facts

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

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