# Attachment URL: /docs/ui/attachment UI components for attaching and viewing files in messages. *** title: Attachment description: UI components for attaching and viewing files in messages. ----------------------------------------------------------------------- import { ParametersTable } from "@/components/docs/tables/ParametersTable"; import { AttachmentSample } from "@/components/docs/samples/attachment-sample"; import { InstallCommand } from "@/components/docs/fumadocs/install/install-command"; **Note:** These components provide the UI for attachments, but you also need to configure attachment adapters in your runtime to handle file uploads and processing. See the [Attachments Guide](/docs/guides/attachments) for complete setup instructions. ## Getting Started ### Add `attachment` This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed. ### Use in your application ```tsx title="/components/assistant-ui/thread.tsx" {1-4,9-10} import { ComposerAttachments, ComposerAddAttachment, } from "@/components/assistant-ui/attachment"; const Composer: FC = () => { return ( ); }; ``` ```tsx title="/components/assistant-ui/thread.tsx" {1,8} import { UserMessageAttachments } from "@/components/assistant-ui/attachment"; const UserMessage: FC = () => { return (
); }; ```
## API Reference ### Composer Attachments #### ComposerPrimitive.Attachments Renders all attachments in the composer. #### ComposerPrimitive.AddAttachment A button that opens the file picker to add attachments. This primitive renders a `