파일 업로드

파일 업로드는 하나 이상의 디바이스의 로컬 파일을 선택하고 첨부하는 데 사용하는 입력 컴포넌트이다.

사용 지침

민원 첨부·증빙 자료 제출처럼 파일 첨부가 필요한 폼에 사용하고, 허용 확장자·최대 용량·다중 선택 여부를 사전에 안내해 업로드 실패를 줄입니다.

예제

기본

타이틀영역

컨텐츠 영역

첨부할 파일을 여기에 끌어다 놓거나, 파일 선택 버튼을 눌러 파일을 직접 선택해주세요.

examples/file-upload/FileUploadDefault.tsx
import { FileUpload } from "@/components/ui/file-upload"

export default function FileUploadDefault() {

파일 목록 포함

파일 목록 예시

다양한 상태의 파일 목록을 보여줍니다.

첨부할 파일을 여기에 끌어다 놓거나, 파일 선택 버튼을 눌러 파일을 직접 선택해주세요.

6/ 10
  • 업로드중_파일.pdf [pdf, 512KB]
    업로드 중
  • 완료된_파일.docx [docx, 2MB]
  • 준비된_파일.hwp [hwp, 768KB]
  • 오류_파일.exe [exe, 25MB]
    등록 가능한 파일 용량을 초과하였습니다.20MB 미만의 파일만 등록할 수 있습니다.
  • 다운로드_미리보기_파일.jpg [jpg, 1MB]
  • 완료된_PDF.pdf [pdf, 3MB]
examples/file-upload/FileUploadWithFiles.tsx
"use client"

import * as React from "react"

비활성화

파일 업로드

비활성화된 파일 업로드

첨부할 파일을 여기에 끌어다 놓거나, 파일 선택 버튼을 눌러 파일을 직접 선택해주세요.

examples/file-upload/FileUploadDisabled.tsx
import { FileUpload } from "@/components/ui/file-upload"

export default function FileUploadDisabled() {

삭제 불가

삭제 불가능한 파일 업로드

파일 삭제가 허용되지 않습니다.

첨부할 파일을 여기에 끌어다 놓거나, 파일 선택 버튼을 눌러 파일을 직접 선택해주세요.

2/ 10
  • 중요한 문서.pdf [pdf, 1MB]
  • 필수 파일.docx [docx, 2MB]
examples/file-upload/FileUploadNoDelete.tsx
"use client"

import * as React from "react"

제한된 파일 형식

이미지 파일 업로드

JPG, PNG 파일만 업로드 가능합니다.

이미지 파일을 선택하거나 드래그하여 업로드하세요.

examples/file-upload/FileUploadRestrictedFileTypes.tsx
import { FileUpload } from "@/components/ui/file-upload"

export default function FileUploadRestrictedFileTypes() {

인터랙티브

인터랙티브 파일 업로드

실제로 파일을 업로드하고 삭제할 수 있습니다.

파일을 선택하거나 드래그하여 업로드하세요.

examples/file-upload/FileUploadInteractive.tsx
"use client"

import * as React from "react"

속성

이름타입기본값설명
acceptedFileTypesstring[]
allowDeletebooleantrue
aria-labelstringDefines a string value that labels the current element. @see aria-labelledby.
classNamestring
countUnitstring
deleteAllTextstring전체 파일 삭제
deleteTextstring삭제
descriptionstring
disabledbooleanfalse
downloadTextstring다운로드
filesFileItem[]
fileTypeErrorMessage((acceptedLabel: string) => string)(acceptedLabel) => `지원하지 않는 파일 형식입니다.\n${acceptedLabel} 형식만 업로드 가능합니다.`
idstring
maxFilesnumber10
maxFileSizenumber20 * 1024 * 1024
maxSizeErrorMessage((maxSizeLabel: string) => string)(maxSizeLabel) => `등록 가능한 파일 용량을 초과하였습니다.\n${maxSizeLabel} 미만의 파일만 등록할 수 있습니다.`
onAllFilesDelete(() => void)
onClickMouseEventHandler<HTMLDivElement>
onFileDelete((fileId: string) => void)
onFilesChange((files: FileItem[]) => void)
onFileUpload((file: File) => Promise<void>)
previewTextstring바로보기
selectFileTextstring파일선택
styleCSSProperties
tabIndexnumber
uploadErrorMessagestring파일 업로드에 실패했습니다.
uploadingLabelstring업로드 중
uploadTextstring첨부할 파일을 여기에 끌어다 놓거나, 파일 선택 버튼을 눌러 파일을 직접 선택해주세요.
variantenumdefault