MenuButton2
A button that opens and closes a menu.
Code
<script lang="ts">
import { MenuButton } from '@geoffcox/sterling-svelte';
</script>
<MenuButton2>
<!-- button content -->
{#snippet items()}
<!-- <MenuItem> ... -->
{/snippet}
</MenuButton2>
Members
| Property Name | Type | Bindable | Default | Comment |
|---|
| allowFlip | Popover2FlipAxis | undefined | no | undefined |
| items | Snippet | undefined | no | undefined |
| menuClass | string | no | '' |
| menuAnchorOrigin | Popover2Nonant | undefined | no | 'bottom-left' |
| menuPlacement | 'auto'| Popover2Nonant | undefined | no | 'bottom-right' |
| open | boolean | yes | false |
| onClose | (value: string) => void | no | |
| onOpen | (value: string) => void | no | |
| onSelect | (value: string) => void | no | |
| value | string | no | undefined |
Considerations
- MenuButton2 uses Popover2
- Includes Button props, events, and methods.
- Includes HTMLButtonElement props, events, and methods.
Anatomy
<Button class="sterling-menu-button-2">
{@render children()}
</Button>
<Popover>
<Menu class={menuClass}>
{@render items()}
</Menu>
</Popover>