diff --git a/v2/pink-sb/src/lib/input/Select.svelte b/v2/pink-sb/src/lib/input/Select.svelte index b092c6973..b14dfd3a0 100644 --- a/v2/pink-sb/src/lib/input/Select.svelte +++ b/v2/pink-sb/src/lib/input/Select.svelte @@ -16,6 +16,7 @@ badge?: string; leadingIcon?: ComponentType; trailingIcon?: ComponentType; + leadingHtml?: string; }>; } & Partial<{ value: string | boolean | number | null; @@ -35,6 +36,7 @@ export let readonly: $$Props['readonly'] = false; const dispatch = createEventDispatcher(); + let selectedLeadingHtml: undefined | string = undefined; const { elements: { trigger, menu, option }, @@ -55,6 +57,7 @@ portal: null, onSelectedChange(event) { value = event.next?.value; + selectedLeadingHtml = options.find((option) => option.value === value)?.leadingHtml; dispatch('change', value); return event.next; } @@ -76,14 +79,24 @@ disabled={disabled || readonly} > - {$selectedLabel || placeholder} + {#if $selectedLabel} + {#if selectedLeadingHtml} + {@html selectedLeadingHtml} + {/if} + {$selectedLabel} + {:else} + {placeholder} + {/if} {#if $open}