Skip to main content

CnImageWidgetForm

Config sub-form for the image widget — URL, alt text, link, object-fit.

Part of the dashboard widget library (v2). Registered with the dashboard widget registry and consumed by LaunchPad's widget grid. See the widget library overview and docs/architecture/cards-and-widgets.md.

Reference​

Props​

NameTypeRequiredDefaultDescription
editingWidget{content: object}|nullnullThe placement being edited, or null in create mode. Pre-fills every control from editingWidget.content.
valueobject\{ ...DEFAULT_CONTENT \}Initial content values — used when not editing and the parent supplies registry defaults.
fileUploadFnFunctionnullOptional raw-file upload transport async (file: File) => ({ url }) (named fileUploadFn, not uploadFn, to avoid colliding with the base64 uploadFn other sub-forms declare). Called by commit() on submit (never on selection) with the raw picked file; the returned hosted URL is stored (rejected if it uses an unsafe scheme). When omitted, the file is embedded as a data URL on commit instead — allowed only when the raw file is ≤ 1 MB (~1.37 MB once base64-encoded and stored) so a huge inline blob can't freeze the tab.
uploadFnFunctionnullDeprecated — use fileUploadFn. Legacy base64 transport async (dataUrl: string) => ({ url }), kept for backward compatibility. When fileUploadFn is not set but this is, commit() reads the file to a data URL and hands it to this function (a one-time console.warn is emitted). fileUploadFn wins when both are set.

Events​

NamePayloadDescription
update:content—Emitted with the assembled {url, alt, link, fit} blob on every field change.