BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/agent-elements/attachment-button

attachment-button

agent-elements/attachment-button
FreeComponent

agent-elements publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://agent-elements.21st.dev/r/attachment-button.json

Source

registry/agent-elements/components/input/attachment-button.tsxagent-elements.21st.dev/r/attachment-button.json
1import { memo, type ReactNode } from "react";
2import { IconPaperclip, IconPlus } from "@tabler/icons-react";
3
4export type AttachmentButtonIcon = "plus" | "paperclip";
5
6export type AttachmentButtonProps = {
7 onClick?: () => void;
8 /**
9 * Icon to render inside the button.
10 * - "plus" (default): a `+` glyph, matches the generic "add something" affordance.
11 * - "paperclip": a paperclip glyph, matches the more literal "attach file" affordance.
12 * - Pass any ReactNode to fully override (e.g. a custom svg). The node is
13 * rendered as-is inside the button; size/color from this component's
14 * styling is only applied to the built-in presets.
15 */
16 icon?: AttachmentButtonIcon | ReactNode;
17};
18
19function isIconName(value: unknown): value is AttachmentButtonIcon {
20 return value === "plus" || value === "paperclip";
21}
22
23export const AttachmentButton = memo(function AttachmentButton({
24 onClick,
25 icon = "plus",
26}: AttachmentButtonProps) {
27 const iconClassName = "w-4 h-4 text-neutral-400 dark:text-neutral-600";
28 let iconNode: ReactNode;
29 if (isIconName(icon)) {
30 iconNode =
31 icon === "paperclip" ? (
32 <IconPaperclip className={iconClassName} strokeWidth={2} />
33 ) : (
34 <IconPlus className={iconClassName} strokeWidth={2} />
35 );
36 } else {
37 iconNode = icon;
38 }
39
40 return (
41 <button
42 type="button"
43 onClick={onClick}
44 className="size-7 rounded-full flex items-center justify-center hover:bg-muted transition-colors cursor-pointer"
45 aria-label="Attach"
46 >
47 {iconNode}
48 </button>
49 );
50});

Facts

Registry
agent-elements
Type
registry:ui
Access
Free
Files written
0
Licence
the repository states none
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on agent-elements agent-elements.21st.dev Raw registry item This item as JSON

More from agent-elements

All 25 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
agent-chatagent-chatagent-elementsComponentsFreeno deps
bash-toolbash-toolagent-elementsComponentsFreeno deps
edit-tooledit-toolagent-elementsComponentsFreeno deps
error-messageerror-messageagent-elementsComponentsFreeno deps
file-attachmentfile-attachmentagent-elementsComponentsFreeno deps
generic-toolgeneric-toolagent-elementsComponentsFreeno deps
input-barinput-baragent-elementsComponentsFreeno deps
markdownmarkdownagent-elementsComponentsFreeno deps
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