# EdgeStore Docs: File Field URL: https://edgestore.dev/docs/components/file-field Source: https://raw.githubusercontent.com/edgestorejs/edgestore/refs/heads/main/docs/content/docs/components/file-field.mdx import { DemoBlock } from '@/components/demo-block'; import { LimitedCode } from '@/components/ui/limited-code'; import { OpenTabs, OpenTabsContent, OpenTabsList, OpenTabsTrigger, } from '@/components/ui/open-tabs'; import FileFieldBlock from '@/components/upload/blocks/file-field-block'; import { Step, Steps } from 'fumadocs-ui/components/steps'; Once a file is chosen, the field shows it with its progress and a remove button instead of the drop area. ## Installation CLI Manual Use the shadcn CLI to add the component to your project. npm pnpm yarn bun ```bash npx shadcn@latest add https://edgestore.dev/r/file-field.json ``` ```bash pnpm dlx shadcn@latest add https://edgestore.dev/r/file-field.json ``` ```bash yarn dlx shadcn@latest add https://edgestore.dev/r/file-field.json ``` ```bash bun x shadcn@latest add https://edgestore.dev/r/file-field.json ``` ### Setup for manual installation First you will need to follow the [manual install setup](./manual-install) guide. ### Install required components * [uploader-provider](./uploader-provider) * [dropzone](./dropzone) * [multi-file](./multi-file) ### Copy this component ````tsx title="components/upload/file-field.tsx" 'use client'; import { cn } from '@/lib/utils'; import { UploadIcon } from 'lucide-react'; import * as React from 'react'; import { type Accept } from 'react-dropzone'; import { dropzoneState, dropzoneVariants, useUploadDropzone } from './dropzone'; import { FileListItem } from './multi-file'; import { formatFileSize } from './upload-utils'; import { useUploader } from './uploader-provider'; /** * Props for the FileField component. */ export type FileFieldProps = Omit, 'children'> & { /** * Accepted file types. */ accept?: Accept; /** * Human-readable list of accepted types, shown in the hint and messages. * * @example "PDF, DOC or DOCX" */ typesLabel?: string; /** * Maximum file size in bytes. */ maxSize?: number; /** * Whether the field is disabled. */ disabled?: boolean; /** * Id for the hidden file input, so a ` ## Usage Install or copy the component from [Installation](#installation) before using this example. ```tsx 'use client'; import { FileField } from '@/components/upload/file-field'; import { DOCUMENT_ACCEPT } from '@/components/upload/upload-utils'; import { UploaderProvider, type UploadFn, } from '@/components/upload/uploader-provider'; import { useEdgeStore } from '@/lib/edgestore'; import * as React from 'react'; export function FileFieldUsage() { const { edgestore } = useEdgeStore(); const uploadFn: UploadFn = React.useCallback( async ({ file, onProgressChange, signal }) => { const res = await edgestore.publicFiles.upload({ file, signal, onProgressChange, }); // you can run some server action or api here // to add the necessary data to your database console.log(res); return res; }, [edgestore], ); return ( ); } ``` ## Props | Prop | Type | Default | Description | | ----------------- | --------- | --------- | ------------------------------------------------------------------------------------------------------------------------ | | `inputId` | `string` | | Id for the hidden file input, so a `