File Input
Drop or browse for files, listed below the zone.
Drag and drop files here
Or paste them from your clipboard.
Install and use
The first command adds the component and the Mine theme, the second adds this example. Render <Mine> once near your root for the skin, sounds and narrator.
"use client"
import {
FileInput,
FileInputDropzone,
FileInputItem,
FileInputItemRemove,
FileInputList,
FileInputTrigger,
formatFileSize,
} from "@/components/ui/file-input"
import { FileIcon, UploadIcon, XIcon } from "lucide-react"
function Example() {
return (
<FileInput multiple>
<FileInputDropzone>
<UploadIcon aria-hidden="true" />
<p>Drag and drop files here</p>
<p data-slot="hint">Or paste them from your clipboard.</p>
<FileInputTrigger>Browse Files</FileInputTrigger>
</FileInputDropzone>
<FileInputList aria-label="Files">
<FileInputItem>
{({ file }) => (
<>
<FileIcon aria-hidden="true" />
<span>{file.name}</span>
<span data-slot="hint">{formatFileSize(file.size)}</span>
<FileInputItemRemove>
<XIcon aria-hidden="true" />
</FileInputItemRemove>
</>
)}
</FileInputItem>
</FileInputList>
</FileInput>
)
}
export { Example }