Skip to content

Component: Base64EncodedImageField

A field for uploading and displaying base64-encoded images with drag & drop support.

typescript
import Base64EncodedImageField from '@nhtio/vuetify-fields/components/fields/base64_encoded_image'

Examples

vue
<Base64EncodedImageField v-model="imageData" />
vue
<!-- Restrict to SVG files only -->
<Base64EncodedImageField
  v-model="svgData"
  :accepted-types="['svg']"
  openFilePickerLabel="SVG Upload"
/>

Result


Reference

Props

NameTypeDefaultRequired
appendIconany | undefinedundefined
The icon to append to the field.
aspectRatiostring | number | undefinedundefined
The aspect ratio for the image display area.
densitystring"default"
The density of the input field.
disabledbooleanfalse
Whether the field is disabled.
clearablebooleanfalse
Whether to show a clear button when there's a value.
errorbooleanfalse
Whether the field is in an error state.
errorMessagesstring | string[]
() => []
Error messages to display below the field.
focusedbooleanfalse
Whether the field is focused.
heightstring | number | undefinedundefined
The height of the image display area.
hideDetailsbooleanfalse
Whether to hide the details section (hint, error messages).
hideSpinButtonsbooleanfalse
Whether to hide spin buttons on number inputs.
hintstring | undefinedundefined
Hint text to display below the field.
idstring | undefinedundefined
The HTML id attribute for the field.
labelstring | undefinedundefined
The label text for the field.
loadingbooleanfalse
Whether to show a loading indicator.
maxErrorsstring | number1
Maximum number of error messages to display.
maxWidthstring | number | undefinedundefined
Maximum width of the image display area.
maxHeightstring | number | undefinedundefined
Maximum height of the image display area.
messagesstring | string[]
() => []
Messages to display below the field.
minWidthstring | number | undefinedundefined
Minimum width of the image display area.
minHeightstring | number | undefinedundefined
Minimum height of the image display area.
modelValuestring | null | undefinedundefined
The current base64-encoded image value.
namestring | undefinedundefined
The HTML name attribute for the field.
persistentHintbooleanfalse
Whether to always show the hint text.
prependIconany | undefinedundefined
The icon to prepend to the field.
readonlybooleanfalse
Whether the field is readonly.
rulesany[] | undefinedundefined
Validation rules for the field.
themestring | undefinedundefined
The theme to apply to the field.
validateOn| "eager" | "lazy" | "blur" | "input" | "submit" | "invalid-input" | "blur lazy" | "input lazy" | "submit lazy" | "invalid-input lazy" | "blur eager" | "input eager" | "submit eager" | "invalid-input eager" | "lazy blur" | "lazy input" | "lazy submit" | "lazy invalid-input" | "eager blur" | "eager input" | "eager submit" | "eager invalid-input" | undefinedundefined
When to trigger validation.
validationValuestring | undefinedundefined
The value to use for validation.
variant"outlined""outlined"
The field variant style.
widthstring | number | undefinedundefined
The width of the image display area.
onChange() => voidundefined
Callback function called when the value changes.
onFocus() => voidundefined
Callback function called when the field is focused.
onBlur() => voidundefined
Callback function called when the field loses focus.
onInput() => voidundefined
Callback function called on input events.
openFilePickerLabelstring"Open File Picker"
The label text for the file picker button.
acceptedTypesstring[]
() => []
Array of accepted image file types (e.g., ['svg', 'png', 'jpg']). Empty array allows all image types.

Events

NameType
update:modelValue
 (val: string | null) => void 
Emitted when the value is changed.
Properties:
NameTypeDescription
string["val"]The current base64-encoded image value.
update:model-value
 (val: string | null) => void 
Emitted when the value is changed.
Properties:
NameTypeDescription
string["val"]The current base64-encoded image value.
update
 (val: string | null) => void 
Emitted when the value is changed.
Properties:
NameTypeDescription
string["val"]The current base64-encoded image value.