Dropdown
A value and a <button> to open/close a floating content box
Code
<script lang="ts">
import { Dropdown } from '@geoffcox/sterling-svelte';
</script>
<Dropdown>
<svelte:fragment slot="value">
// dropdown value
</svelte:fragment>
<div>
// dropdown content
</div>
</Dropdown>
Members
| Property Name | Type | Default | Comment | | disabled | string | false |
| open | string | false |
| stayOpenOnClickAway | string | false |
| variant | string | '' |
| Event Name | Data | Comment | | open | {open: boolean} |
Considerations
- Includes HTMLDivElement props, event, and methods
Anatomy
<div class="sterling-dropdown">
<div class="value">
<slot name="value" {disabled} {open} {variant} />
</div>
<slot name="button" {disabled} {open} {variant}>
<div class="button">
<slot name="icon" {disabled} {open} {variant}>
<div class="chevron" />
</slot>
</div>
</slot>
<Popover>
<div class="sterling-dropdown-popup-content">
<slot {disabled} {open} {variant} />
</div>
</Popover>
</div>