mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 11:59:34 +00:00
20 lines
482 B
Svelte
20 lines
482 B
Svelte
<script>
|
|
import { ComboBox, Button } from "carbon-components-svelte";
|
|
let selectedId = "1";
|
|
</script>
|
|
|
|
<ComboBox
|
|
titleText="Contact"
|
|
placeholder="Select contact method"
|
|
bind:selectedId
|
|
items="{[
|
|
{ id: '0', text: 'Slack' },
|
|
{ id: '1', text: 'Email' },
|
|
{ id: '2', text: 'Fax' },
|
|
]}"
|
|
/>
|
|
<br />
|
|
<Button on:click="{() => (selectedId = undefined)}"
|
|
>Set to undefined (unselected)</Button
|
|
>
|
|
<Button on:click="{() => (selectedId = '2')}">Set to 2 (Fax)</Button>
|