combobox: rough option snippets implementation
This commit is contained in:
@@ -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)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user