Native File Input
A native file picker with shared availability, naming, required, and focus policy.
Applies shared availability, required state, accessible naming, and focus policy to a native <input type="file">, while leaving file selection and the system picker to the browser.
Preview
Section titled “Preview”The preview mounts nativeFileInput onto real input[type="file"] elements via the React Adapter—the first is required and accepts multiple files, and the second is disabled (files are read locally from FileList and never uploaded).
Loading the actual Base Native File Input…
Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases.
import { nativeFileInput, asNativeFileInput } from '@proto.ui/prototypes-base/native-file-input';This subpath also exports the default prototype, NativeFileInputProps, NativeFileInputExposes, and NativeFileInputAsHookContract, while the package root re-exports the named entries. The prototype and hook share the same setup.
Binding to a physical file input
Section titled “Binding to a physical file input”Provide a real <input type="file"> root element and pass disabled and required to both the prototype and the native element so accessibility, focus policy, and browser behavior target the same input.
Manage accept, multiple, picker invocation, native change events, and clearing directly on the host element, and read selected files from its native files property. The prototype has no text value and emits no valueChange event.
Focus and naming
Section titled “Focus and naming”ariaLabelprovides the accessible name while preserving the native file input role.focusSelf(options?)andblurSelf()follow the shared Focus protocol. A disabled input ignoresfocusSelf()and leaves normal focus order; re-enabling restores focus participation without reopening the picker.- An associated
ControlLabelcan focus an enabled input without synthesizing a click or opening the system file picker.
| Prop | Type | Default |
|---|---|---|
disabled | boolean | false |
required | boolean | false |
ariaLabel | string | '' |
Removing a previously supplied prop restores its default value.
- Exposed states:
disabled,required,focused,focusVisible. - Exposed methods:
focusSelf(options?),blurSelf().