Skip to content

Interface: UseImageDialogResult ​

Returned by useImageDialog(): the controller state as fields, plus actions and prop getters.

Extends ​

Properties ​

PropertyModifierTypeDescriptionInherited from
altreadonlystringCurrent value of the alternative text field.ImageDialogState.alt
availablereadonlybooleanWhether the editor can hold images at all (has advancedSchema()).ImageDialogState.available
decorativereadonlybooleanDecorative images get alt="" and are skipped by screen readers.ImageDialogState.decorative
errorreadonlystring | nullValidation message, or null.ImageDialogState.error
errorFieldreadonly"src" | "alt" | nullWhich field the error belongs to.ImageDialogState.errorField
imageSelectedreadonlybooleanWhether an image is selected, so the trigger opens in "edit" mode.ImageDialogState.imageSelected
modereadonly"insert" | "edit""insert" adds a new image by address; "edit" changes the selected image.ImageDialogState.mode
openreadonlybooleanThe dialog is open.ImageDialogState.open
srcreadonlystringCurrent value of the address field.ImageDialogState.src

Methods ​

close() ​

ts
close(): void;

Close without applying and focus the editor. Does nothing while closed.

Returns ​

void


getAltHintProps() ​

ts
getAltHintProps(): ReactProps;

Props for the hint text the alt input's aria-describedby points to.

Returns ​

ReactProps


getAltInputProps() ​

ts
getAltInputProps(): ReactProps;

Props for the alternative text input: id, value, aria-required, aria-describedby (hint, and error when invalid). Disabled and empty while the image is marked decorative.

Returns ​

ReactProps


getBackdropProps() ​

ts
getBackdropProps(): ReactProps;

An optional full-screen layer behind the panel; a press on it closes the dialog.

Returns ​

ReactProps


getCancelProps() ​

ts
getCancelProps(): ReactProps;

Props for the Cancel button, which closes the dialog.

Returns ​

ReactProps


getDecorativeProps() ​

ts
getDecorativeProps(): ReactProps;

Props for the "decorative image" checkbox.

Returns ​

ReactProps


getDialogProps() ​

ts
getDialogProps(): ReactProps;

The modal panel. Traps Tab inside and closes on Escape.

Returns ​

ReactProps


getErrorProps() ​

ts
getErrorProps(): ReactProps;

Props for the error message: role="alert", hidden while there is no error.

Returns ​

ReactProps


getFormProps() ​

ts
getFormProps(): ReactProps;

Props for the form: submit validates and applies instead of submitting the page.

Returns ​

ReactProps


getSrcInputProps() ​

ts
getSrcInputProps(): ReactProps;

Props for the address input: id, value, inputmode="url"; aria-invalid and aria-describedby on error.

Returns ​

ReactProps


getTitleProps() ​

ts
getTitleProps(): ReactProps;

Props for the dialog title: the id the dialog's aria-labelledby points to.

Returns ​

ReactProps


getTriggerProps() ​

ts
getTriggerProps(): ReactProps;

Props for the toolbar button: aria-label (add or edit image), aria-haspopup, aria-expanded, data-state; disabled without image support. Click opens the dialog; mousedown is prevented to keep the selection.

Returns ​

ReactProps


openDialog() ​

ts
openDialog(): void;

Open for the selected image (edit) or a new one (insert).

Returns ​

void