Skip to main content

IconPicker

A universal icon picker for extension config panels. Lets users select from Lucide icons, Unicode emojis, platform emotes, or custom uploads.

Importโ€‹

import { IconPicker } from "@zaflun/lumio-sdk";
import type { IconValue } from "@zaflun/lumio-sdk";

Propsโ€‹

PropTypeRequiredDescription
valueIconValue | nullYesCurrent selection
onChange(icon: IconValue | null) => voidYesCalled when the user picks or clears
sourcesIconSource[]NoEnabled tabs (default: all four)
size"sm" | "md" | "lg"NoButton size (default: "md")
placeholderstringNoText shown when no icon selected

IconValueโ€‹

All icon selections produce a universal IconValue object:

interface IconValue {
type: "lucide" | "emoji" | "emote" | "upload";
value: string;
label?: string;
platform?: string;
}
Typevaluelabelplatform
lucideIcon name ("heart")Display name--
emojiUnicode character ("๐Ÿ˜€")Emoji name--
emoteCDN URLEmote name"twitch" | "7tv" | "bttv" | "ffz"
uploadUpload URLOriginal filename--

Sourcesโ€‹

Control which tabs appear with the sources prop:

// Only Lucide icons and emojis
<IconPicker
value={icon}
onChange={setIcon}
sources={["lucide", "emoji"]}
/>

Available sources: "lucide", "emoji", "emote", "upload".

Exampleโ€‹

import { Lumio, CompactView, IconPicker, IconDisplay, useExtensionStorage } from "@zaflun/lumio-sdk";
import type { IconValue } from "@zaflun/lumio-sdk";

interface MyConfig {
icon: IconValue | null;
title: string;
}

function Editor() {
const [config, setConfig] = useExtensionStorage<MyConfig>();

return (
<CompactView title="Alert Settings">
<IconPicker
value={config.icon ?? null}
onChange={(icon) => setConfig({ ...config, icon })}
placeholder="Choose alert icon"
size="md"
/>
<IconDisplay icon={config.icon ?? null} size={32} />
</CompactView>
);
}

Lumio.render(<Editor />, { target: "editor" });

Upload Tabโ€‹

The upload tab uses ctx.upload() internally. Uploaded files are stored in the extension's storage bucket. Limits:

  • Max file size: 256 KB
  • Accepted formats: PNG, JPG, GIF, SVG, WebP, AVIF
  • Quota: 50 files per extension per account

Duplicate uploads are deduplicated by content hash.