Displays an input that lets users upload an image and see its preview.
acceptreadonly ("image/jpeg" | "image/png" | "image/gif" | "image/svg+xml" | "image/webp" | "image/avif" | "image/x-icon" | "image/vnd.microsoft.icon")[] | ("image/jpeg" | "image/png" | "image/gif" | ... 4 more ... | "image/vnd.microsoft.icon")[]defaultFilestring | File | nullfilestring | File | nullmaxDimensions{ width: number; height: number; }maxSizeKBnumberminDimensions{ width: number; height: number; }namestringplaceholderstringrationumberstateAlso supports MarginProps: `m`, `mb`, `ml`, `mr`, `mt`, `mx`, `my`
backgroundColorstringsrcstring | nullA placeholder is rendered when no preview is displayed. Use the placeholder prop to change the default text.
Make the Root part controlled to access the uploaded file.
Use the onSrcChange prop to access the temporary URL of the preview image.
Use a URL for the defaultFile prop to create an uncontrolled field with an initial value.
You can render a custom preview layout if you pass a function as a child of the Preview part.
Use the backgroundColor prop on the Preview part to set a background color on the preview image.
Use the available validation props to enforce constraints upon the uploaded images. Use the onError prop to access the errors.
2 variants found
/:environmentId/applications/:applicationId
<ImageField.Root
accept={VALID_LOGO_TYPES}
aria-label={label}
file={file === undefined ? logoUrl : file}
maxSizeKB={MAX_LOGO_SIZE_KB}
minDimensions={{ height: MIN_LOGO_DIMENSION, width: MIN_LOGO_DIMENSION }}
name={name}
placeholder={label}
ratio={1}
state={disabled ? 'disabled' : 'normal'}
onError={onError}
onFileChange={onFileChange}
>
<ImageField.Preview
backgroundColor={theme === 'dark' ? 'var(--gray-1)' : '#ffffff'}
src={previewSrc}
/>
</ImageField.Root>/:environmentId/applications/:applicationId
<ImageField.Root
accept={VALID_LOGO_TYPES}
aria-label={label}
file={file === undefined ? logoUrl : file}
maxSizeKB={MAX_LOGO_SIZE_KB}
minDimensions={{ height: MIN_LOGO_DIMENSION, width: MIN_LOGO_DIMENSION }}
name={name}
placeholder={label}
ratio={1}
state={disabled ? 'disabled' : 'normal'}
onError={onError}
onFileChange={onFileChange}
>
<ImageField.Preview
backgroundColor={theme === 'dark' ? 'var(--gray-1)' : '#ffffff'}
src={previewSrc}
/>
</ImageField.Root>Also supports MarginProps: m, mb, ml, mr, mt, mx, my
Used 18 times across 1 package
3 files
/branding/edit
/:environmentId/applications/:applicationId