Ga naar hoofdinhoud

CnIconPicker

Select-plus-upload picker for the dashboard icon convention. The built-in <select> emits a registry key (e.g. 'Star'); the optional file-upload reads a data URL, hands it to the injected uploadFn, and emits the returned URL. The upload transport is the consumer's — pass uploadFn (e.g. an app's resource upload); when omitted the upload control is hidden so the library carries no upload dependency.

Vue 2 v-model: value in, input out.

<CnIconPicker v-model="icon" :upload-fn="uploadDataUrl" />

Props

NameTypeDefaultDescription
valueStringnullCurrent icon value — a registry key, a URL, or null (v-model).
iconsObjectDASHBOARD_ICONSIcon registry to enumerate in the select (name → component).
uploadFnFunctionnullInjected upload transport async (dataUrl) => ({ url }). When null, the upload control is hidden.
compactBooleanfalseCompact mode — render a small trigger button that opens the icon grid as a popover instead of an always-visible grid. Suited to table rows / tight inline layouts.
clearableBooleanfalseShow a leading "None" tile that clears the selection (emits null). Off by default so existing pickers are unchanged.

Events

NameDescription
inputEmitted with the new icon value (registry key, URL, or null).

See also CnDashboardIcon for rendering, and the DASHBOARD_ICONS / DEFAULT_ICON / getIconComponent / isCustomIconUrl helpers.