mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 11:11:25 +00:00
feat(data-table): add ToolbarMenu
Requires menuRef from OverflowMenu to be exported.
This commit is contained in:
parent
0e9f600672
commit
c39427670a
10 changed files with 305 additions and 72 deletions
22
src/DataTable/ToolbarMenu.svelte
Normal file
22
src/DataTable/ToolbarMenu.svelte
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script>
|
||||
import { getContext } from "svelte";
|
||||
import Settings16 from "carbon-icons-svelte/lib/Settings16";
|
||||
import { OverflowMenu } from "../OverflowMenu";
|
||||
|
||||
const ctx = getContext("Toolbar");
|
||||
|
||||
let menuRef = null;
|
||||
|
||||
$: ctx.setOverflow(menuRef != null);
|
||||
$: if (menuRef) menuRef.style.top = "100%";
|
||||
</script>
|
||||
|
||||
<OverflowMenu
|
||||
bind:menuRef
|
||||
icon="{Settings16}"
|
||||
{...$$restProps}
|
||||
class="bx--toolbar-action bx--overflow-menu {$$restProps.class}"
|
||||
flipped
|
||||
>
|
||||
<slot />
|
||||
</OverflowMenu>
|
Loading…
Add table
Add a link
Reference in a new issue