ImageInput

A drop-zone input for uploading images, with previews.

Installation

pnpm dlx shadcn@latest add @chelone/image-input
Loading preview…

A drop-zone input for uploading images, with previews.

Props

PropTypeDefaultDescription
alwaysOnboolean—As a `<FilterForm>`/`<FilterButton>` filter: always shown, never in the add-filter menu. Read off the element by the filter layer, never by the input.
defaultValueNoInfer<SourceValue<TRecord, TPath>>—Input-level default, ra precedence (seeds only into an untouched hole). Typed as the value at `source`; `unknown` without a record.
disabledboolean—Native disabled state.
helperTextReactNode—Helper text rendered below the input; a string is translated.
idstring—Explicit element id; a generated `useId` value is used otherwise.
isRequiredboolean—Forces the required marker; ORed with `required()` detection on `validate`.
labelReactNode—The input label. A string is translated; a ReactNode renders as-is; `false` (or `""`) renders no label.
namestring—Legacy field-name alias (ra parity); the wiring uses `source`.
onBlur(event: unknown) => void—Chained AFTER the blur is recorded.
onChange(eventOrValue: unknown) => void—Chained AFTER the parsed value is written to the form.
readOnlyboolean—Native read-only state.
resourcestring—Override the ambient resource (used to resolve the default label key).
sourceTPath—The field path RELATIVE to the ambient source scope.
validateValidator | readonly Validator[]—ra-contract validators — composed, first error wins.
acceptDropzoneOptions["accept"]—
childrenReactNode—
classNamestring—
format(value: FileSelection) => FileSelection—Read transform (the files in the form → the files shown). Default makes a preview record of each dropped file.
inputPropsDropzoneInputProps & React.ComponentProps<"input">—
labelMultiplestring—
labelSinglestring—
maxSizeDropzoneOptions["maxSize"]—
minSizeDropzoneOptions["minSize"]—
multipleDropzoneOptions["multiple"]—
onRemove(file: FileEntry) => void—
optionsDropzoneOptions—
parse(value: FileSelection) => FileSelection—Write transform (the dropped or remaining files → stored value). Default makes a preview record of each dropped file.
placeholderReactNode—
removeIconComponentType<{ className?: string }>—
validateFileRemovalunknown—