Renders an image that is also its own upload button, for a dump's thumbnail and a playlist's cover.
f
ImagePicker(unnamed 0: ImagePickerProps): React.JSX.Element
Renders the image, or a placeholder, which opens the file picker on a click, Enter or Space. The picker only reads the file, and uploads nothing itself.
I
ImagePickerProps
Passed to ImagePicker by an edit page, which uploads the file and
then passes the new image, or a local preview of it, as src.
-
accept: string
Replaces the default types, which are JPEG, PNG, GIF and WebP.
- alt: string
-
borderRadius: number | string
In pixels when a number, or any CSS length, such as a radius token.
- className: string
-
onChange: (file: File) => void
Called with the file picked. The same file can be picked again.
-
size: number
Sets the side, in pixels. Without it,
classNamesizes the picker. -
src: string | null
Shows a "+" placeholder when null.
-
uploading: boolean
Disables the picker and shows "…" while the caller uploads.
Usage
import * as mod from "src/components/shared/ImagePicker.tsx";