combobox: rough option snippets implementation

This commit is contained in:
Elijah Duffy
2026-03-09 16:37:02 -07:00
parent 28c027c48b
commit f06867ad75
2 changed files with 118 additions and 16 deletions

View File

@@ -164,6 +164,16 @@
</div>
</div>
{#snippet comboRender(item: ComboboxOption)}
Opt 1
{/snippet}
{#snippet comboInfotext(item: ComboboxOption)}
User
{/snippet}
{#snippet comboPreview(item: ComboboxOption)}
Preview {item.label}
{/snippet}
<div class="component">
<p class="title">Combobox</p>
@@ -172,7 +182,19 @@
name="example-combobox"
label="Select an option"
placeholder="Choose..."
options={comboboxOptions}
options={[
{
value: 'option1',
label: 'Option 1',
preview: 'Prvw',
infotext: 'Info',
render: comboRender,
infotextRender: comboInfotext,
previewRender: comboPreview
},
{ value: 'option2', label: 'Option 2' },
{ value: 'option3', label: 'Option 3', disabled: true }
]}
onchange={(e) => console.log('Selected:', e.value)}
onvalidate={(e) => console.log('Validation:', e.detail)}
/>