File Input

Native file selection, labels, validation and disabled presentation

File Input

Use a real file input for browser-owned file selection. Files are submitted under the input’s name. CSS cannot read files, upload them, generate previews or implement drag/drop.

Imports

Individual example prerequisites (including composition and demo actions):

@import "@duskmoon-dev/core/base.css";
@import "@duskmoon-dev/core/themes/sunshine";
@import "@duskmoon-dev/core/components/file-input.css";
@import "@duskmoon-dev/core/components/form-group.css";
@import "@duskmoon-dev/core/components/button.css";

base.css supplies global focus/utility definitions and shared spacing/shape tokens; use your framework reset when appropriate. Substitute the Moonlight theme for dark forms.

Aggregate: @duskmoon-dev/core; no-Tailwind: @duskmoon-dev/core/standalone.css. Individual: @duskmoon-dev/core/components/file-input.css, a theme/reset, and form-group.css for composition. Existing input.css and form.css imports continue to include File Input. Extensionless components/file-input exports generated css and styles.

Native Selection

Required attachment

PDF or image. The application checks file size and content.

Error: select an attachment.

accept is a picker hint, not security validation. Validate files again on the server. Use multiple for multiple files; read files or FormData.getAll(). Reset clears the native selection. Applications must separately clear previews and upload state.

Error And Disabled States

Server error and disabled file picker

Error: the uploaded file exceeded the size limit.

API

Sizes: .file-input-xs, sm, default/medium, lg. Colors: .file-input-primary, secondary, tertiary, info, success, warning, error; .file-input-ghost hides the ordinary border. The file-selector button inherits the control palette; native focus is visible. Use the Validator contract for native opt-in or explicit ARIA invalid state.

File Upload is the richer, application-controlled dropzone, preview and progress composition, not this basic input.