docs/components/input/ImageInput

ImageInput

Image upload with preview.

import { ImageInput } from '@ybouhjira/hyperkit';

#Playground

Edit the code — the preview recompiles and re-renders as you type.

Live playground
Loading preview…

#Props

PropTypeDefaultDescription
valueFile | File[] | nullCurrently selected image file(s).
onChange *(files: File | File[] | null) => voidCallback when images are selected or removed.
mode'single' | 'multiple''single'Selection mode: 'single' for one image, 'multiple' for many.
acceptstring'image/*'Accepted MIME types.
maxSizenumberMaximum file size in bytes.
placeholderstring'Select image'Placeholder text shown when no images are selected.
previewSizenumber80Preview thumbnail size in pixels.
disabledbooleanfalseDisable image selection.
classstringAdditional CSS classes.
styleJSX.CSSPropertiesCustom styles.
onError(error: { type: 'validation' | 'format' | 'size' | 'corrupt'; message: string; file?: File; }) => voidCallback when a file validation or processing error occurs.
errorstringError message to display (controlled). When set, shows error state.

* required prop.

#Design Tokens

This component reads the following CSS custom properties. Override them globally or per-instance to restyle it — see the CSS Variables guide.

  • --sk-accent
  • --sk-accent-subtle
  • --sk-bg-secondary
  • --sk-border
  • --sk-color-danger
  • --sk-color-danger-bg
  • --sk-font-size-sm
  • --sk-image-input-bg
  • --sk-image-input-border
  • --sk-image-input-preview-size
  • --sk-image-input-radius
  • --sk-radius-md
  • --sk-radius-sm
  • --sk-space-sm
  • --sk-space-xl
  • --sk-text-muted