BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nexus-ui/attachments

Attachments

nexus-ui/attachments
FreeComponent

Composable file attachments for chat inputs and messages with preview, variants, and upload wiring

Live preview

live · rendered by the registry
Rendered by nexus-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://nexus-ui.dev/r/attachments.json

Source

components/nexus-ui/attachments.tsxnexus-ui.dev/r/attachments.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { createPortal } from "react-dom";
5import { Slot } from "@radix-ui/react-slot";
6import { cva, type VariantProps } from "class-variance-authority";
7import {
8 Cancel01Icon,
9 Image02Icon,
10 File02Icon,
11 Video02Icon,
12 MusicNote02Icon,
13 Upload01Icon,
14} from "@hugeicons/core-free-icons";
15import { HugeiconsIcon } from "@hugeicons/react";
16import { useOnChange } from "@/lib/use-on-change";
17
18import { cn } from "@/lib/utils";
19
20// ——— Metadata schema (single source) ———
21
22/** Upload or message attachment metadata. */
23export interface AttachmentMeta {
24 type: "image" | "file" | "video" | "audio";
25 name?: string;
26 url?: string;
27 /** Raster preview URL (e.g. PDF first page). When unset, preview uses the icon for `type`. */
28 thumbnailUrl?: string;
29 mimeType?: string;
30 size?: number;
31 width?: number;
32 height?: number;
33 /** Binary payload when not using `url` (browser-friendly; prefer `Blob`). */
34 data?: Blob | ArrayBuffer;
35 /**
36 * **`"paste"`** when created from clipboard (e.g. long text → **`File`**). Use with **`Attachment`** **`variant="pasted"`**.
37 */
38 source?: "paste";
39}
40
41/** Files not appended by the picker: oversized, over `maxFiles`, extra when `multiple` is false, or outside `accept`. */
42export type AttachmentsRejectedFiles = {
43 tooLarge: File[];
44 /** Within size but did not fit under `maxFiles`. */
45 overMaxFiles: File[];
46 /** Ignored because `multiple` is false. */
47 truncatedByMultiple: File[];
48 /** Did not match the root `accept` string (drop path or permissive pickers). */
49 notAccepted: File[];
50};
51
52export function toAttachmentMeta(
53 file: File,
54 options?: { objectUrl?: string; source?: AttachmentMeta["source"] },
55): AttachmentMeta {
56 const mime = file.type?.toLowerCase() ?? "";
57 let kind: AttachmentMeta["type"] = "file";
58 if (mime.startsWith("image/")) kind = "image";
59 else if (mime.startsWith("video/")) kind = "video";
60 else if (mime.startsWith("audio/")) kind = "audio";
61
62 return {
63 type: kind,
64 name: file.name,
65 url: options?.objectUrl,
66 mimeType: file.type || undefined,
67 size: file.size,
68 ...(options?.source != null ? { source: options.source } : {}),
69 };
70}
71
72/** Optional second argument to **`appendFiles`** (from **`useAttachments`**). */
73export type AppendFilesOptions = {
74 /** Sets **`AttachmentMeta.source`** to **`"paste"`** for every appended item. */
75 paste?: boolean;
76};
77
78/**
79// … truncated

What it pulls in

npm packages

  • @radix-ui/react-slot
  • class-variance-authority
  • @hugeicons/react
  • @hugeicons/core-free-icons

Files it writes

  • components/nexus-ui/attachments.tsx
  • lib/use-on-change.ts

Facts

Registry
nexus-ui
Type
registry:ui
Access
Free
Files written
2
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

Docs on nexus-ui nexus-ui.dev victorcodess/nexus-ui on GitHub Raw registry item This item as JSON

More from nexus-ui

All 15 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Chain of Thoughtchain-of-thoughtnexus-uiComponentsFree2 deps · 2 files
Citationcitationnexus-uiComponentsFree4 deps
Feedback Barfeedback-barnexus-uiComponentsFree1 dep
Imageimagenexus-uiComponentsFree2 deps
Messagemessagenexus-uiComponentsFree9 deps · 2 files
Model Selectormodel-selectornexus-uiComponentsFree3 deps
Prompt Inputprompt-inputnexus-uiComponentsFree1 dep
Questionsquestionsnexus-uiComponentsFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex