Input Message
nexvyn/input-messageFreeComponent
An auto-growing chat composer with drag-and-drop file attachments, image/PDF preview tiles, and Enter-to-send.
Live preview
live · rendered by the registry
Rendered by nexvyn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.nexvyn.dev/r/input-message.jsonSource
1'use client'23import {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 MouseEvent as ReactMouseEvent,16 type ReactNode,17 type TextareaHTMLAttributes,18} from 'react'19import { AnimatePresence, motion, useReducedMotion } from 'motion/react'20import { cn } from '@/lib/utils'21import { springs } from '@/lib/motion-tokens'2223const useIsoLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect2425const DEFAULT_ACCEPT = 'image/png,image/jpeg,application/pdf'2627function ArrowUpIcon({ className }: { className?: string }) {28 return (29 <svg30 width={16}31 height={16}32 viewBox="0 0 24 24"33 fill="none"34 stroke="currentColor"35 strokeWidth={2}36 strokeLinecap="round"37 strokeLinejoin="round"38 aria-hidden="true"39 className={className}40 >41 <path d="M12 19V5" />42 <path d="M5 12l7-7 7 7" />43 </svg>44 )45}4647function XIcon({ className }: { className?: string }) {48 return (49 <svg50 width={12}51 height={12}52 viewBox="0 0 24 24"53 fill="none"54 stroke="currentColor"55 strokeWidth={2.5}56 strokeLinecap="round"57 strokeLinejoin="round"58 aria-hidden="true"59 className={className}60 >61 <path d="M18 6L6 18" />62 <path d="M6 6l12 12" />63 </svg>64 )65}6667function FileIcon({ className }: { className?: string }) {68 return (69 <svg70 width={20}71 height={20}72 viewBox="0 0 24 24"73 fill="none"74 stroke="currentColor"75 strokeWidth={1.5}76 strokeLinecap="round"77 strokeLinejoin="round"78 aria-hidden="true"79 className={className}80 >81 <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />82 <path d="M14 2v6h6" />83 </svg>84 )85}8687interface InputMessageSlotContext {88 openFilePicker: (acceptOverride?: string) => void89 files: File[]90}9192type InputMessageSlot = ReactNode | ((ctx: InputMessageSlotContext) => ReactNode)9394export interface InputMessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {95 value: string96 onValueChange: (value: string) => void97 onSend?: (value: string, files: File[]) => void98 placeholder?: string99 leftSlot?: InputMessageSlot100 rightSlot?: InputMessageSlot101 disabled?: boolean102 minRows?: number103 maxRows?: number104 clickToFocus?: boolean105 sendLabel?: string106// … truncated
What it pulls in
npm packages
Files it writes
More from nexvyn
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Badgebadge | nexvyn | Components | Free | 2 deps · 2 files | |
| Bars Themebars-theme | nexvyn | Components | Free | 1 dep · 3 files | |
| Bounce Sidebarbounce-sidebar | nexvyn | Components | Free | 1 dep · 2 files | |
| Breadcrumbsbreadcrumbs | nexvyn | Components | Free | 1 dep · 2 files | |
| Checkboxcheckbox | nexvyn | Components | Free | 1 dep · 3 files | |
| Clipboard Fieldclipboard-field | nexvyn | Components | Free | no deps · 2 files | |
| Color Pickercolor-picker | nexvyn | Components | Free | no deps · 16 files | |
| Comboboxcombobox | nexvyn | Components | Free | 1 dep · 2 files |
