Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Dropzone

File-drop affordance — a dashed drop target (label/hint/icon) that wraps a native file input; drag-over via data-active.

All components · Theme builder · Implementation source

Live preview

Open live dropzone preview

Install

Shell
netscript ui:add dropzone

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
import { useState } from 'preact/hooks';
import { Dropzone } from '@app/components/ui/dropzone.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><Dropzone onFiles={(files) => report(`${files.length} files selected`)} /></div><p role="status">{notice}</p></>);
}

Props

Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

OwnerPropTypeOptionalDescription
DropzonePropslabelstringYesPrimary call-to-action text.
DropzonePropshintstringYesSecondary hint (accepted types, size limits).
DropzonePropsiconRenderableYesLeading glyph or icon node.
DropzonePropsactivebooleanYesActive (drag-over) state.
DropzonePropschildrenRenderableYesTypically a visually-hidden <input type="file">.
DropzonePropsacceptstringYesNative accept string applied to drop, paste, and picker ingest.
DropzonePropsmultiplebooleanYesWhether the dropzone accepts more than one file per ingest event.
DropzonePropsonFile(file: File, details: DropzoneIngestDetails) => voidYesCalled with the first accepted file for simple single-file consumers.
DropzonePropsonFiles(files: [object Object], details: DropzoneIngestDetails) => voidYesCalled with every accepted file from drop, paste, or picker ingest.
DropzonePropsonReject(files: [object Object], details: DropzoneIngestDetails) => voidYesCalled with every rejected file from drop, paste, or picker ingest.
DropzonePropsonDropJSX.DragEventHandler<HTMLLabelElement>Yes
DropzonePropsonDragOverJSX.DragEventHandler<HTMLLabelElement>Yes
DropzonePropsonPasteJSX.ClipboardEventHandler<HTMLLabelElement>Yes
DropzonePropsclassstringYes
TypeScript
type DropzoneIngestSource = [object Object]
type DropzoneRejectedReason = [object Object]
DropzoneProps extends Omit<JSX.HTMLAttributes<HTMLLabelElement>, "class" | "onDrop" | "onDragOver" | "onPaste">

Keyboard

Presentation component; no component-specific keyboard interactions.

Tokens

Semantic contract roles: border/strong, border/width, destructive/text, primary/default, radius/card, surface/selected, surface/surface, text/muted.

CSS custom properties referenced directly: --ns-border, --ns-border-strong, --ns-card, --ns-destructive, --ns-ease-fast, --ns-fg, --ns-focus-ring-offset, --ns-focus-ring-width, --ns-muted, --ns-muted-fg, --ns-primary, --ns-primary-subtle, --ns-radius-card, --ns-radius-full, --ns-radius-lg, --ns-ring, --ns-selected, --ns-space-2, --ns-space-6, --ns-space-9, --ns-surface, --ns-text-2xs, --ns-text-lg, --ns-text-sm.

Contract and compatibility

Accessibility pattern: native file input

  • Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.

Search all documentation

Type a term to search the documentation.