runway

Runway

File

A file component that displays a single file with its name, size, and type.


example.txt

TXT • 12.06 KB

example.mp4

MP4 • 12.06 KB

example.pdf

PDF • 12.06 KB

example.png

PNG • 12.06 KB


The File component displays a single file, rendering its filename, size and an icon based on the file type.

The FileDrop component uses this component to display the files that have been uploaded.



Usage

javascript

1import File from "@/components/atoms/File";
2
3<File
4    file={{
5        name: "example.txt",
6        size: 12345,
7        type: "text/plain",
8    }}
9/>



Props

PropTypeDefaultDescription
fileobject-The file to display.
namestring-The name of the file.
onRemovefunction-The function to call when the remove button is clicked.
showRemoveButtonbooleanfalseIf true, the remove button is displayed.
colorstring"bg"The base color (use tailwind.config).
variant"soft" | "solid""solid"The variant of the component.
iconColorstring"primary"The color of the file icon (use tailwind.config).
borderRadiusstring"lg"The border radius of the component.
borderbooleantrueIf true, a border is displayed around the component.
borderColorstring"gray"The base color (use tailwind.config).
showFileTypebooleantrueIf true, the file type is displayed.
showFileSizebooleantrueIf true, the file size is displayed.
classNamestring""Additional Tailwind utility classes.
...propsobject-Any other valid HTML attributes.



Examples

Basic File

example.txt

TXT • 12.06 KB


Customized Files

example.txt

TXT • 12.06 KB

image.png

PNG • 96.45 KB


Different File Types

text.txt

TXT • 12.06 KB

image.png

PNG • 96.45 KB

video.mp4

MP4 • 1205.63 KB

audio.mp3

MP3 • 120.56 KB

document.pdf

PDF • 1205.63 KB

archive.zip

ZIP • 1205.63 KB

spreadsheet.xlsx

XLSX • 1205.63 KB