Skip to content

Forms

Dropzone

Takes files or a whole folder by drop or by the system's chooser: a game folder, a math release.

Drop a game folder

Its art, sound, texts and math, as one folder.

No folder yet.

Installation

Terminal
pnpm add @elsikora/keystone-ui-kit

Usage

Import
import { Dropzone } from "@elsikora/keystone-ui-kit";
docs/dropzone/default.example.tsx
import { useState } from "react";import { Dropzone } from "@elsikora/keystone-ui-kit";
export default function DropzoneDefaultExample() {  const [count, setCount] = useState<number | null>(null);
  return (    <div className="flex flex-col gap-3">      <Dropzone        directory        label="Drop a game folder"        description="Its art, sound, texts and math, as one folder."        onFiles={(files): void => {          setCount(files.length);        }}      />      <p className="text-sm text-fg-2">{count === null ? "No folder yet." : `${String(count)} files.`}</p>    </div>  );}

Examples

A folder

Drop a game folder

Its art, sound, texts and math, as one folder.

No folder yet.

Files

Drop math files

Disabled

Uploads are closed

API reference

Dropzone

PropTypeDefaultDescription
labelReactNode-What to give.
descriptionReactNode-What to give and what happens next.
directorybooleanfalseA folder, every level, instead of single files.
acceptstring-File types the chooser offers.
buttonLabelstring"Choose files" or "Choose a folder"The chooser button's words.
disabledbooleanfalseUnavailable.
onError(error: unknown) => void-Called when a dropped folder or file cannot be read; the drop then gives no files.
onFiles(files: ReadonlyArray<{ file: File; path: string }>) => void-Every file of one choice or drop, with its path in the folder.

Notes

  • The button is the keyboard's way in; the drop area is an addition, never the only way.