md-split-button spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
One default action plus a menu of variations. Two fused segments: a leading button that runs the default action, and a trailing toggle that opens a menu. The component renders the button — you supply and position the menu.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button>
<md-split-button variant="tonal" icon="add" label="Create" menu-label="More create options"></md-split-button>
<md-split-button variant="elevated" icon="send" label="Send" menu-label="Send options"></md-split-button>
<md-split-button variant="outlined" icon="merge" label="Merge" menu-label="Other merge strategies"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton variant="filled" icon="save" label="Save" menuLabel="More save options"></MdSplitButton>
<MdSplitButton variant="tonal" icon="add" label="Create" menuLabel="More create options"></MdSplitButton>
<MdSplitButton variant="elevated" icon="send" label="Send" menuLabel="Send options"></MdSplitButton>
<MdSplitButton variant="outlined" icon="merge" label="Merge" menuLabel="Other merge strategies"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button>
<md-split-button variant="tonal" icon="add" label="Create" menu-label="More create options"></md-split-button>
<md-split-button variant="elevated" icon="send" label="Send" menu-label="Send options"></md-split-button>
<md-split-button variant="outlined" icon="merge" label="Merge" menu-label="Other merge strategies"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button>
<md-split-button variant="tonal" icon="add" label="Create" menu-label="More create options"></md-split-button>
<md-split-button variant="elevated" icon="send" label="Send" menu-label="Send options"></md-split-button>
<md-split-button variant="outlined" icon="merge" label="Merge" menu-label="Other merge strategies"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button>
<md-split-button variant="tonal" icon="add" label="Create" menu-label="More create options"></md-split-button>
<md-split-button variant="elevated" icon="send" label="Send" menu-label="Send options"></md-split-button>
<md-split-button variant="outlined" icon="merge" label="Merge" menu-label="Other merge strategies"></md-split-button>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-split-button in your project: Option A registers every AWC UI
component at once (simplest), Option B imports only this component for
tree-shake-friendly bundles.
<!-- ─── Option A: global registration (all components) ─── -->
<script type="module">
import '@awc-ui/core/define';
</script>
<!-- ─── Option B: single import (tree-shake only md-split-button) ─── -->
<script type="module">
import '@awc-ui/core/components/md-split-button';
</script>
<md-split-button></md-split-button>// ─── Option A: typed React wrapper (registers all components) ───
// Importing from '@awc-ui/react' calls defineCustomElements() as a
// side effect, so every md-* element becomes available in the browser.
import { MdSplitButton } from '@awc-ui/react';
export function Example() {
return <MdSplitButton></MdSplitButton>;
}
// ─── Option B: single import (tree-shake to only md-split-button) ───
// Skip the wrapper and use the raw custom element. Smallest bundle,
// but you lose typed props/events on JSX.
import '@awc-ui/core/components/md-split-button';
export function ExampleTreeShaken() {
return <md-split-button></md-split-button>;
}// ─── Option A: schema module (any md-* element accepted) ───
// Pair with `defineCustomElements(window)` in main.ts.
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `<md-split-button></md-split-button>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-split-button'` in main.ts.
import { Component } from '@angular/core';
import { MdSplitButton } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdSplitButton],
template: `<md-split-button></md-split-button>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdSplitButton } from '@awc-ui/vue';
</script>
<template>
<MdSplitButton></MdSplitButton>
</template>
<!-- ─── Option B: single import (tree-shake to only md-split-button) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-split-button';
</script>
<template>
<md-split-button></md-split-button>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-split-button></md-split-button>
<!-- ─── Option B: single import (tree-shake to only md-split-button) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-split-button';
</script>
<md-split-button></md-split-button>| Situation | Use instead |
|---|---|
| No obvious default among the options | md-button + md-menu, or md-select |
| The options are unrelated commands | md-icon-button + md-menu |
| Choosing a value rather than running an action | md-select / md-segmented-button |
| 2–5 equal, mutually exclusive choices | md-segmented-button |
| Several equal actions as a unit | md-button-group |
| A single action | md-button |
| The trailing side toggles state rather than opening a popup | md-button toggle, or set haspopup="false" |
This is the component’s entire purpose, so it is worth spelling out. Four things have to be wired:
| Wire | How | Why |
|---|---|---|
| Default action | mdLeadingClick | The leading segment never opens anything |
| Open / close | mdTrailingClick → menu.show() / menu.close() | The component owns no popup |
| ARIA | haspopup="menu" + controls="<menu id>" | Announces “opens a menu” and links trigger to popup |
Chevron + aria-expanded | menu’s mdClose → split.trailingChecked = false | Otherwise the chevron lies after an outside click or Escape |
e.detail.checked on mdTrailingClick is the new state of the toggle, so
it maps directly onto show/close.
<md-split-button
id="sb-save" icon="save" label="Save" variant="filled"
menu-label="More save options"
haspopup="menu" controls="sb-save-menu"
></md-split-button>
<md-menu id="sb-save-menu" anchor="sb-save" placement="bottom-end">
<md-menu-item headline="Save as…"></md-menu-item>
<md-menu-item headline="Save a copy"></md-menu-item>
<md-menu-item headline="Save and close"></md-menu-item>
</md-menu>
<script type="module">
const split = document.getElementById('sb-save');
const menu = document.getElementById('sb-save-menu');
split.addEventListener('mdLeadingClick', () => save());
split.addEventListener('mdTrailingClick', (e) => {
e.detail.checked ? menu.show() : menu.close();
});
// Outside click, Escape or an item pick all close the menu — resync the chevron.
menu.addEventListener('mdClose', () => { split.trailingChecked = false; });
</script>import { useState } from 'react';
import { MdSplitButton, MdMenu, MdMenuItem } from '@awc-ui/react';
export function SaveSplitButton() {
// One piece of state drives both the chevron (trailingChecked) and the menu
// (open) — no refs, no imperative show()/close().
const [open, setOpen] = useState(false);
return (
<>
<MdSplitButton
id="sb-save"
icon="save"
label="Save"
variant="filled"
menuLabel="More save options"
haspopup="menu"
controls="sb-save-menu"
trailingChecked={open}
onMdLeadingClick={() => save()}
onMdTrailingClick={(e) => setOpen(e.detail.checked)}
/>
<MdMenu
id="sb-save-menu"
anchor="sb-save"
placement="bottom-end"
open={open}
onMdClose={() => setOpen(false)}
>
<MdMenuItem headline="Save as…" />
<MdMenuItem headline="Save a copy" />
<MdMenuItem headline="Save and close" />
</MdMenu>
</>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-save-split-button',
template: `
<md-split-button
id="sb-save" icon="save" label="Save" variant="filled"
menu-label="More save options"
haspopup="menu" controls="sb-save-menu"
[trailingChecked]="open"
(mdLeadingClick)="save()"
(mdTrailingClick)="open = $event.detail.checked"
></md-split-button>
<md-menu id="sb-save-menu" anchor="sb-save" placement="bottom-end"
[open]="open" (mdClose)="open = false">
<md-menu-item headline="Save as…"></md-menu-item>
<md-menu-item headline="Save a copy"></md-menu-item>
<md-menu-item headline="Save and close"></md-menu-item>
</md-menu>
`,
})
export class SaveSplitButtonComponent {
open = false;
save() { /* default action */ }
}<script setup lang="ts">
import { ref } from 'vue';
const open = ref(false);
function save() { /* default action */ }
</script>
<template>
<md-split-button
id="sb-save" icon="save" label="Save" variant="filled"
menu-label="More save options"
haspopup="menu" controls="sb-save-menu"
:trailing-checked="open"
@mdLeadingClick="save"
@mdTrailingClick="open = $event.detail.checked"
/>
<md-menu id="sb-save-menu" anchor="sb-save" placement="bottom-end"
:open="open" @mdClose="open = false">
<md-menu-item headline="Save as…" />
<md-menu-item headline="Save a copy" />
<md-menu-item headline="Save and close" />
</md-menu>
</template><script lang="ts">
let open = false;
function save() { /* default action */ }
</script>
<md-split-button
id="sb-save" icon="save" label="Save" variant="filled"
menu-label="More save options"
haspopup="menu" controls="sb-save-menu"
trailing-checked={open || undefined}
on:mdLeadingClick={save}
on:mdTrailingClick={(e) => (open = e.detail.checked)}
></md-split-button>
<md-menu id="sb-save-menu" anchor="sb-save" placement="bottom-end"
open={open || undefined} on:mdClose={() => (open = false)}>
<md-menu-item headline="Save as…"></md-menu-item>
<md-menu-item headline="Save a copy"></md-menu-item>
<md-menu-item headline="Save and close"></md-menu-item>
</md-menu>The same four wires carry any flow. Two more, live — a send menu and a
version-control merge menu, each with its own md-menu:
<md-split-button
id="sb-send" icon="send" label="Send" variant="tonal"
menu-label="Send options" haspopup="menu" controls="sb-send-menu"
></md-split-button>
<md-menu id="sb-send-menu" anchor="sb-send" placement="bottom-end">
<md-menu-item headline="Schedule send"></md-menu-item>
<md-menu-item headline="Send without attachments"></md-menu-item>
<md-menu-item headline="Send and archive"></md-menu-item>
</md-menu>
<md-split-button
id="sb-merge" icon="merge" label="Merge pull request" variant="outlined"
menu-label="Other merge strategies" haspopup="menu" controls="sb-merge-menu"
></md-split-button>
<md-menu id="sb-merge-menu" anchor="sb-merge" placement="bottom-end">
<md-menu-item headline="Squash and merge"></md-menu-item>
<md-menu-item headline="Rebase and merge"></md-menu-item>
<md-menu-item headline="Create a merge commit" divider></md-menu-item>
<md-menu-item headline="Merge without waiting for checks"></md-menu-item>
</md-menu>
<script type="module">
// The same four wires, once per pair.
for (const [triggerId, menuId] of [
['sb-send', 'sb-send-menu'],
['sb-merge', 'sb-merge-menu'],
]) {
const split = document.getElementById(triggerId);
const menu = document.getElementById(menuId);
split.addEventListener('mdTrailingClick', (e) => {
e.detail.checked ? menu.show() : menu.close();
});
menu.addEventListener('mdClose', () => { split.trailingChecked = false; });
}
</script>import { useState } from 'react';
import { MdSplitButton, MdMenu, MdMenuItem } from '@awc-ui/react';
export function Toolbar() {
// One boolean per pair — the chevron and the menu read the same state.
const [sendOpen, setSendOpen] = useState(false);
const [mergeOpen, setMergeOpen] = useState(false);
return (
<>
<MdSplitButton
id="sb-send"
icon="send"
label="Send"
variant="tonal"
menuLabel="Send options"
haspopup="menu"
controls="sb-send-menu"
trailingChecked={sendOpen}
onMdTrailingClick={(e) => setSendOpen(e.detail.checked)}
/>
<MdMenu
id="sb-send-menu"
anchor="sb-send"
placement="bottom-end"
open={sendOpen}
onMdClose={() => setSendOpen(false)}
>
<MdMenuItem headline="Schedule send" />
<MdMenuItem headline="Send without attachments" />
<MdMenuItem headline="Send and archive" />
</MdMenu>
<MdSplitButton
id="sb-merge"
icon="merge"
label="Merge pull request"
variant="outlined"
menuLabel="Other merge strategies"
haspopup="menu"
controls="sb-merge-menu"
trailingChecked={mergeOpen}
onMdTrailingClick={(e) => setMergeOpen(e.detail.checked)}
/>
<MdMenu
id="sb-merge-menu"
anchor="sb-merge"
placement="bottom-end"
open={mergeOpen}
onMdClose={() => setMergeOpen(false)}
>
<MdMenuItem headline="Squash and merge" />
<MdMenuItem headline="Rebase and merge" />
<MdMenuItem headline="Create a merge commit" divider />
<MdMenuItem headline="Merge without waiting for checks" />
</MdMenu>
</>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-toolbar',
template: `
<md-split-button
id="sb-send" icon="send" label="Send" variant="tonal"
menu-label="Send options" haspopup="menu" controls="sb-send-menu"
[trailingChecked]="sendOpen"
(mdTrailingClick)="sendOpen = $event.detail.checked"
></md-split-button>
<md-menu id="sb-send-menu" anchor="sb-send" placement="bottom-end"
[open]="sendOpen" (mdClose)="sendOpen = false">
<md-menu-item headline="Schedule send"></md-menu-item>
<md-menu-item headline="Send without attachments"></md-menu-item>
<md-menu-item headline="Send and archive"></md-menu-item>
</md-menu>
<md-split-button
id="sb-merge" icon="merge" label="Merge pull request" variant="outlined"
menu-label="Other merge strategies" haspopup="menu" controls="sb-merge-menu"
[trailingChecked]="mergeOpen"
(mdTrailingClick)="mergeOpen = $event.detail.checked"
></md-split-button>
<md-menu id="sb-merge-menu" anchor="sb-merge" placement="bottom-end"
[open]="mergeOpen" (mdClose)="mergeOpen = false">
<md-menu-item headline="Squash and merge"></md-menu-item>
<md-menu-item headline="Rebase and merge"></md-menu-item>
<md-menu-item headline="Create a merge commit" divider></md-menu-item>
<md-menu-item headline="Merge without waiting for checks"></md-menu-item>
</md-menu>
`,
})
export class ToolbarComponent {
sendOpen = false;
mergeOpen = false;
}<script setup lang="ts">
import { ref } from 'vue';
const sendOpen = ref(false);
const mergeOpen = ref(false);
</script>
<template>
<md-split-button
id="sb-send" icon="send" label="Send" variant="tonal"
menu-label="Send options" haspopup="menu" controls="sb-send-menu"
:trailing-checked="sendOpen"
@mdTrailingClick="sendOpen = $event.detail.checked"
/>
<md-menu id="sb-send-menu" anchor="sb-send" placement="bottom-end"
:open="sendOpen" @mdClose="sendOpen = false">
<md-menu-item headline="Schedule send" />
<md-menu-item headline="Send without attachments" />
<md-menu-item headline="Send and archive" />
</md-menu>
<md-split-button
id="sb-merge" icon="merge" label="Merge pull request" variant="outlined"
menu-label="Other merge strategies" haspopup="menu" controls="sb-merge-menu"
:trailing-checked="mergeOpen"
@mdTrailingClick="mergeOpen = $event.detail.checked"
/>
<md-menu id="sb-merge-menu" anchor="sb-merge" placement="bottom-end"
:open="mergeOpen" @mdClose="mergeOpen = false">
<md-menu-item headline="Squash and merge" />
<md-menu-item headline="Rebase and merge" />
<md-menu-item headline="Create a merge commit" divider />
<md-menu-item headline="Merge without waiting for checks" />
</md-menu>
</template><script lang="ts">
let sendOpen = false;
let mergeOpen = false;
</script>
<md-split-button
id="sb-send" icon="send" label="Send" variant="tonal"
menu-label="Send options" haspopup="menu" controls="sb-send-menu"
trailing-checked={sendOpen || undefined}
on:mdTrailingClick={(e) => (sendOpen = e.detail.checked)}
></md-split-button>
<md-menu id="sb-send-menu" anchor="sb-send" placement="bottom-end"
open={sendOpen || undefined} on:mdClose={() => (sendOpen = false)}>
<md-menu-item headline="Schedule send"></md-menu-item>
<md-menu-item headline="Send without attachments"></md-menu-item>
<md-menu-item headline="Send and archive"></md-menu-item>
</md-menu>
<md-split-button
id="sb-merge" icon="merge" label="Merge pull request" variant="outlined"
menu-label="Other merge strategies" haspopup="menu" controls="sb-merge-menu"
trailing-checked={mergeOpen || undefined}
on:mdTrailingClick={(e) => (mergeOpen = e.detail.checked)}
></md-split-button>
<md-menu id="sb-merge-menu" anchor="sb-merge" placement="bottom-end"
open={mergeOpen || undefined} on:mdClose={() => (mergeOpen = false)}>
<md-menu-item headline="Squash and merge"></md-menu-item>
<md-menu-item headline="Rebase and merge"></md-menu-item>
<md-menu-item headline="Create a merge commit" divider></md-menu-item>
<md-menu-item headline="Merge without waiting for checks"></md-menu-item>
</md-menu>variant sets the emphasis of the whole control — both segments move together.
The default is filled.
| Variant | Emphasis | Use for |
|---|---|---|
filled | Highest | The one primary action on the screen |
tonal | High | A strong action that isn’t the primary one |
elevated | Medium | Action sitting on a busy or coloured surface |
outlined | Low | Secondary action next to a filled one |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button variant="filled" icon="save" label="Filled" menu-label="More options"></md-split-button>
<md-split-button variant="tonal" icon="save" label="Tonal" menu-label="More options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Elevated" menu-label="More options"></md-split-button>
<md-split-button variant="outlined" icon="save" label="Outlined" menu-label="More options"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton variant="filled" icon="save" label="Filled" menuLabel="More options"></MdSplitButton>
<MdSplitButton variant="tonal" icon="save" label="Tonal" menuLabel="More options"></MdSplitButton>
<MdSplitButton variant="elevated" icon="save" label="Elevated" menuLabel="More options"></MdSplitButton>
<MdSplitButton variant="outlined" icon="save" label="Outlined" menuLabel="More options"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button variant="filled" icon="save" label="Filled" menu-label="More options"></md-split-button>
<md-split-button variant="tonal" icon="save" label="Tonal" menu-label="More options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Elevated" menu-label="More options"></md-split-button>
<md-split-button variant="outlined" icon="save" label="Outlined" menu-label="More options"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button variant="filled" icon="save" label="Filled" menu-label="More options"></md-split-button>
<md-split-button variant="tonal" icon="save" label="Tonal" menu-label="More options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Elevated" menu-label="More options"></md-split-button>
<md-split-button variant="outlined" icon="save" label="Outlined" menu-label="More options"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button variant="filled" icon="save" label="Filled" menu-label="More options"></md-split-button>
<md-split-button variant="tonal" icon="save" label="Tonal" menu-label="More options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Elevated" menu-label="More options"></md-split-button>
<md-split-button variant="outlined" icon="save" label="Outlined" menu-label="More options"></md-split-button>| Size | Height |
|---|---|
xs | 32px |
sm (default) | 40px |
md | 56px |
lg | 96px |
xl | 136px |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button size="xs" icon="save" label="Extra small" menu-label="More options"></md-split-button>
<md-split-button size="sm" icon="save" label="Small" menu-label="More options"></md-split-button>
<md-split-button size="md" icon="save" label="Medium" menu-label="More options"></md-split-button>
<md-split-button size="lg" icon="save" label="Large" menu-label="More options"></md-split-button>
<md-split-button size="xl" icon="save" label="Extra large" menu-label="More options"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton size="xs" icon="save" label="Extra small" menuLabel="More options"></MdSplitButton>
<MdSplitButton size="sm" icon="save" label="Small" menuLabel="More options"></MdSplitButton>
<MdSplitButton size="md" icon="save" label="Medium" menuLabel="More options"></MdSplitButton>
<MdSplitButton size="lg" icon="save" label="Large" menuLabel="More options"></MdSplitButton>
<MdSplitButton size="xl" icon="save" label="Extra large" menuLabel="More options"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button size="xs" icon="save" label="Extra small" menu-label="More options"></md-split-button>
<md-split-button size="sm" icon="save" label="Small" menu-label="More options"></md-split-button>
<md-split-button size="md" icon="save" label="Medium" menu-label="More options"></md-split-button>
<md-split-button size="lg" icon="save" label="Large" menu-label="More options"></md-split-button>
<md-split-button size="xl" icon="save" label="Extra large" menu-label="More options"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button size="xs" icon="save" label="Extra small" menu-label="More options"></md-split-button>
<md-split-button size="sm" icon="save" label="Small" menu-label="More options"></md-split-button>
<md-split-button size="md" icon="save" label="Medium" menu-label="More options"></md-split-button>
<md-split-button size="lg" icon="save" label="Large" menu-label="More options"></md-split-button>
<md-split-button size="xl" icon="save" label="Extra large" menu-label="More options"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button size="xs" icon="save" label="Extra small" menu-label="More options"></md-split-button>
<md-split-button size="sm" icon="save" label="Small" menu-label="More options"></md-split-button>
<md-split-button size="md" icon="save" label="Medium" menu-label="More options"></md-split-button>
<md-split-button size="lg" icon="save" label="Large" menu-label="More options"></md-split-button>
<md-split-button size="xl" icon="save" label="Extra large" menu-label="More options"></md-split-button>The two segments take their glyphs from two different props. icon is the
leading action’s Material Symbols name and is optional; trailing-icon is the
toggle’s glyph and defaults to keyboard_arrow_down. Both scale with size.
| Prop | Segment | Default |
|---|---|---|
icon | Leading | '' — no icon |
trailing-icon | Trailing toggle | 'keyboard_arrow_down' |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button icon="save" label="With an icon" menu-label="More options"></md-split-button>
<md-split-button label="Label only" menu-label="More options"></md-split-button>
<md-split-button icon="filter_list" label="Filter" trailing-icon="expand_more" menu-label="Filter options"></md-split-button>
<md-split-button icon="palette" label="Theme" trailing-icon="more_vert" menu-label="Theme options" variant="outlined"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton icon="save" label="With an icon" menuLabel="More options"></MdSplitButton>
<MdSplitButton label="Label only" menuLabel="More options"></MdSplitButton>
<MdSplitButton icon="filter_list" label="Filter" trailingIcon="expand_more" menuLabel="Filter options"></MdSplitButton>
<MdSplitButton icon="palette" label="Theme" trailingIcon="more_vert" menuLabel="Theme options" variant="outlined"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button icon="save" label="With an icon" menu-label="More options"></md-split-button>
<md-split-button label="Label only" menu-label="More options"></md-split-button>
<md-split-button icon="filter_list" label="Filter" trailing-icon="expand_more" menu-label="Filter options"></md-split-button>
<md-split-button icon="palette" label="Theme" trailing-icon="more_vert" menu-label="Theme options" variant="outlined"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button icon="save" label="With an icon" menu-label="More options"></md-split-button>
<md-split-button label="Label only" menu-label="More options"></md-split-button>
<md-split-button icon="filter_list" label="Filter" trailing-icon="expand_more" menu-label="Filter options"></md-split-button>
<md-split-button icon="palette" label="Theme" trailing-icon="more_vert" menu-label="Theme options" variant="outlined"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button icon="save" label="With an icon" menu-label="More options"></md-split-button>
<md-split-button label="Label only" menu-label="More options"></md-split-button>
<md-split-button icon="filter_list" label="Filter" trailing-icon="expand_more" menu-label="Filter options"></md-split-button>
<md-split-button icon="palette" label="Theme" trailing-icon="more_vert" menu-label="Theme options" variant="outlined"></md-split-button><!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button icon="edit" aria-label="Edit item" menu-label="More edit options" variant="tonal"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton icon="edit" aria-label="Edit item" menuLabel="More edit options" variant="tonal"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button icon="edit" aria-label="Edit item" menu-label="More edit options" variant="tonal"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button icon="edit" aria-label="Edit item" menu-label="More edit options" variant="tonal"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button icon="edit" aria-label="Edit item" menu-label="More edit options" variant="tonal"></md-split-button>disabled disables both segments and drops them from the tab order;
soft-disabled keeps them focusable so an unavailable action stays
discoverable.
| State | Focusable | Use when |
|---|---|---|
| default | yes | The action is available |
disabled | no | The action is gone and its absence needs no explanation |
soft-disabled | yes | The action is temporarily unavailable and users must be able to find out why |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button icon="save" label="Enabled" menu-label="More options"></md-split-button>
<md-split-button icon="save" label="Disabled" menu-label="More options" disabled></md-split-button>
<md-split-button icon="save" label="Soft-disabled" menu-label="More options" soft-disabled></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton icon="save" label="Enabled" menuLabel="More options"></MdSplitButton>
<MdSplitButton icon="save" label="Disabled" menuLabel="More options" disabled></MdSplitButton>
<MdSplitButton icon="save" label="Soft-disabled" menuLabel="More options" soft-disabled></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button icon="save" label="Enabled" menu-label="More options"></md-split-button>
<md-split-button icon="save" label="Disabled" menu-label="More options" disabled></md-split-button>
<md-split-button icon="save" label="Soft-disabled" menu-label="More options" soft-disabled></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button icon="save" label="Enabled" menu-label="More options"></md-split-button>
<md-split-button icon="save" label="Disabled" menu-label="More options" disabled></md-split-button>
<md-split-button icon="save" label="Soft-disabled" menu-label="More options" soft-disabled></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button icon="save" label="Enabled" menu-label="More options"></md-split-button>
<md-split-button icon="save" label="Disabled" menu-label="More options" disabled></md-split-button>
<md-split-button icon="save" label="Soft-disabled" menu-label="More options" soft-disabled></md-split-button>trailing-checked is the toggle’s own state and drives both the chevron
rotation and aria-expanded. When the trailing side toggles state rather than
opening a popup, set haspopup="false" so nothing is announced as a popup.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button icon="notifications" label="Follow" menu-label="Notification settings" haspopup="false"></md-split-button>
<md-split-button icon="notifications" label="Following" menu-label="Notification settings" haspopup="false" trailing-checked></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton icon="notifications" label="Follow" menuLabel="Notification settings" haspopup="false"></MdSplitButton>
<MdSplitButton icon="notifications" label="Following" menuLabel="Notification settings" haspopup="false" trailing-checked></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button icon="notifications" label="Follow" menu-label="Notification settings" haspopup="false"></md-split-button>
<md-split-button icon="notifications" label="Following" menu-label="Notification settings" haspopup="false" trailing-checked></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button icon="notifications" label="Follow" menu-label="Notification settings" haspopup="false"></md-split-button>
<md-split-button icon="notifications" label="Following" menu-label="Notification settings" haspopup="false" trailing-checked></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button icon="notifications" label="Follow" menu-label="Notification settings" haspopup="false"></md-split-button>
<md-split-button icon="notifications" label="Following" menu-label="Notification settings" haspopup="false" trailing-checked></md-split-button>full-width grows the leading segment to fill the container and truncates
its label with an ellipsis; the trailing toggle keeps its intrinsic width so it
stays a fixed-size target.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="inline-size: 100%; max-inline-size: 420px; display: flex; flex-direction: column; gap: 16px;">
<md-split-button full-width icon="cloud_upload" label="Upload" variant="filled" menu-label="Upload options"></md-split-button>
<md-split-button full-width icon="description" label="Save and continue to the next step" variant="outlined" menu-label="Save options"></md-split-button>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ inlineSize: '100%', maxInlineSize: '420px', display: 'flex', flexDirection: 'column', gap: '16px' }}>
<MdSplitButton fullWidth icon="cloud_upload" label="Upload" variant="filled" menuLabel="Upload options"></MdSplitButton>
<MdSplitButton fullWidth icon="description" label="Save and continue to the next step" variant="outlined" menuLabel="Save options"></MdSplitButton>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="inline-size: 100%; max-inline-size: 420px; display: flex; flex-direction: column; gap: 16px;">
<md-split-button full-width icon="cloud_upload" label="Upload" variant="filled" menu-label="Upload options"></md-split-button>
<md-split-button full-width icon="description" label="Save and continue to the next step" variant="outlined" menu-label="Save options"></md-split-button>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="inline-size: 100%; max-inline-size: 420px; display: flex; flex-direction: column; gap: 16px;">
<md-split-button full-width icon="cloud_upload" label="Upload" variant="filled" menu-label="Upload options"></md-split-button>
<md-split-button full-width icon="description" label="Save and continue to the next step" variant="outlined" menu-label="Save options"></md-split-button>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="inline-size: 100%; max-inline-size: 420px; display: flex; flex-direction: column; gap: 16px;">
<md-split-button full-width icon="cloud_upload" label="Upload" variant="filled" menu-label="Upload options"></md-split-button>
<md-split-button full-width icon="description" label="Save and continue to the next step" variant="outlined" menu-label="Save options"></md-split-button>
</div>| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdLeadingClick | no | void | The leading (default action) segment is activated |
mdTrailingClick | no | { checked: boolean } | The trailing toggle is activated; checked is the new state |
There is no single generic event covering both segments — that is deliberate, since the whole point is telling them apart.
Neither detail has a named exported type — mdTrailingClick is declared inline
as EventEmitter<{ checked: boolean }>, so there is nothing to import from
@awc-ui/core. Type your handler against the shape directly:
function onTrailing( e: CustomEvent<{ /** The state the toggle has just moved INTO — map it onto show/close. */ checked: boolean; }>,) { e.detail.checked ? menu.show() : menu.close();}<md-split-button id="sb" icon="save" label="Save" menu-label="More save options"></md-split-button>
<script type="module">
const sb = document.getElementById('sb');
sb.addEventListener('mdLeadingClick', () => save());
sb.addEventListener('mdTrailingClick', (e) => {
console.log('toggle is now', e.detail.checked);
});
</script>import { MdSplitButton } from '@awc-ui/react';
export function SaveSplitButton() {
return (
<MdSplitButton
icon="save"
label="Save"
menuLabel="More save options"
onMdLeadingClick={() => save()}
onMdTrailingClick={(e) => console.log('toggle is now', e.detail.checked)}
/>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-save-split-button',
template: `
<md-split-button
icon="save" label="Save" menu-label="More save options"
(mdLeadingClick)="save()"
(mdTrailingClick)="onTrailing($event)"
></md-split-button>
`,
})
export class SaveSplitButtonComponent {
save() { /* … */ }
onTrailing(e: CustomEvent<{ checked: boolean }>) {
console.log('toggle is now', e.detail.checked);
}
}<script setup lang="ts">
function save() { /* … */ }
function onTrailing(e: CustomEvent) {
console.log('toggle is now', e.detail.checked);
}
</script>
<template>
<md-split-button
icon="save" label="Save" menu-label="More save options"
@mdLeadingClick="save"
@mdTrailingClick="onTrailing"
/>
</template><script lang="ts">
function save() { /* … */ }
function onTrailing(e: CustomEvent) {
console.log('toggle is now', e.detail.checked);
}
</script>
<md-split-button
icon="save" label="Save" menu-label="More save options"
on:mdLeadingClick={save}
on:mdTrailingClick={onTrailing}
></md-split-button>| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
variant | variant | 'elevated' | 'filled' | 'tonal' | 'outlined' | 'filled' | — |
size | size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'sm' | — |
disabled | disabled | boolean | false | Yes |
softDisabled | soft-disabled | boolean | false | Yes |
icon | icon | string | '' | — |
label | label | string | '' | — |
trailingIcon | trailing-icon | string | 'keyboard_arrow_down' | — |
trailingChecked | trailing-checked | boolean | false | Yes |
menuLabel | menu-label | string | 'Toggle menu' | — |
haspopup | haspopup | | 'menu' | 'listbox' | 'dialog' | 'grid' | 'tree' | 'true' | 'false' | 'menu' | — |
controls | controls | string | '' | — |
fullWidth | full-width | boolean | false | Yes |
ripple | ripple | boolean | true | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
(default) | — |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-split-button-container-color | Container background |
--md-split-button-label-color | Label + icon color |
--md-split-button-icon-color | Icon override |
--md-split-button-outline-color | Outlined border |
--md-split-button-container-shape | Outer corner override |
--md-split-button-icon-size | Icon dimensions |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
leading | Leading button |
leading-state-layer | Leading state overlay |
icon | Leading icon |
label | Label text |
trailing | Trailing button |
trailing-state-layer | Trailing state overlay |
trailing-icon | Trailing menu icon |
label
(or the host aria-label); the trailing one is named only by menu-label
(WCAG 4.1.2) — its default is the English "Toggle menu".haspopup sets aria-haspopup on the trailing button and controls sets
aria-controls. Set haspopup="false" when nothing pops up.aria-expanded is driven by trailing-checked. Keep it truthful — resync it
from the menu’s mdClose, not just from your own click handler.disabled disables both segments and drops them from the tab order;
soft-disabled keeps them focusable.<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button id="sb-a11y-sort" icon="sort" label="Sort" variant="tonal" haspopup="menu" controls="sb-a11y-sort-menu" menu-label="Sort options"></md-split-button>
<md-split-button icon="favorite" label="Like" variant="outlined" haspopup="false" menu-label="Toggle like"></md-split-button>
<md-split-button icon="save" label="Unavailable" soft-disabled menu-label="More save options"></md-split-button>
<md-menu id="sb-a11y-sort-menu" anchor="sb-a11y-sort" placement="bottom-end">
<md-menu-item headline="Newest first"></md-menu-item>
<md-menu-item headline="Oldest first"></md-menu-item>
<md-menu-item headline="Alphabetical"></md-menu-item>
</md-menu>
<script type="module">
var sort = document.getElementById('sb-a11y-sort');
var sortMenu = document.getElementById('sb-a11y-sort-menu');
sort.addEventListener('mdTrailingClick', function (e) {
if (e.detail.checked) { sortMenu.show(); } else { sortMenu.close(); }
});
sortMenu.addEventListener('mdClose', function () { sort.trailingChecked = false; });
</script>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { useEffect, useRef } from 'react';
import { MdMenu, MdMenuItem, MdSplitButton } from '@awc-ui/react';
export function Demo() {
const sortRef = useRef(null);
const sortMenuRef = useRef(null);
useEffect(() => {
const sort = sortRef.current;
const sortMenu = sortMenuRef.current;
sort.addEventListener('mdTrailingClick', function (e) {
if (e.detail.checked) { sortMenu.show(); } else { sortMenu.close(); }
});
sortMenu.addEventListener('mdClose', function () { sort.trailingChecked = false; });
}, []);
return (
<>
<MdSplitButton id="sb-a11y-sort" ref={sortRef} icon="sort" label="Sort" variant="tonal" haspopup="menu" controls="sb-a11y-sort-menu" menuLabel="Sort options"></MdSplitButton>
<MdSplitButton icon="favorite" label="Like" variant="outlined" haspopup="false" menuLabel="Toggle like"></MdSplitButton>
<MdSplitButton icon="save" label="Unavailable" softDisabled menuLabel="More save options"></MdSplitButton>
<MdMenu id="sb-a11y-sort-menu" ref={sortMenuRef} anchor="sb-a11y-sort" placement="bottom-end">
<MdMenuItem headline="Newest first"></MdMenuItem>
<MdMenuItem headline="Oldest first"></MdMenuItem>
<MdMenuItem headline="Alphabetical"></MdMenuItem>
</MdMenu>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
// app.component.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
@ViewChild('sort') sortRef!: ElementRef;
@ViewChild('sortMenu') sortMenuRef!: ElementRef;
ngAfterViewInit() {
const sort = this.sortRef.nativeElement;
const sortMenu = this.sortMenuRef.nativeElement;
sort.addEventListener('mdTrailingClick', function (e) {
if (e.detail.checked) { sortMenu.show(); } else { sortMenu.close(); }
});
sortMenu.addEventListener('mdClose', function () { sort.trailingChecked = false; });
}
}
<!-- app.component.html -->
<md-split-button id="sb-a11y-sort" #sort icon="sort" label="Sort" variant="tonal" haspopup="menu" controls="sb-a11y-sort-menu" menu-label="Sort options"></md-split-button>
<md-split-button icon="favorite" label="Like" variant="outlined" haspopup="false" menu-label="Toggle like"></md-split-button>
<md-split-button icon="save" label="Unavailable" soft-disabled menu-label="More save options"></md-split-button>
<md-menu id="sb-a11y-sort-menu" #sortMenu anchor="sb-a11y-sort" placement="bottom-end">
<md-menu-item headline="Newest first"></md-menu-item>
<md-menu-item headline="Oldest first"></md-menu-item>
<md-menu-item headline="Alphabetical"></md-menu-item>
</md-menu><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMounted, ref } from 'vue';
import '@awc-ui/core/define';
const sortRef = ref(null);
const sortMenuRef = ref(null);
onMounted(() => {
const sort = sortRef.value;
const sortMenu = sortMenuRef.value;
sort.addEventListener('mdTrailingClick', function (e) {
if (e.detail.checked) { sortMenu.show(); } else { sortMenu.close(); }
});
sortMenu.addEventListener('mdClose', function () { sort.trailingChecked = false; });
});
</script>
<template>
<md-split-button id="sb-a11y-sort" ref="sortRef" icon="sort" label="Sort" variant="tonal" haspopup="menu" controls="sb-a11y-sort-menu" menu-label="Sort options"></md-split-button>
<md-split-button icon="favorite" label="Like" variant="outlined" haspopup="false" menu-label="Toggle like"></md-split-button>
<md-split-button icon="save" label="Unavailable" soft-disabled menu-label="More save options"></md-split-button>
<md-menu id="sb-a11y-sort-menu" ref="sortMenuRef" anchor="sb-a11y-sort" placement="bottom-end">
<md-menu-item headline="Newest first"></md-menu-item>
<md-menu-item headline="Oldest first"></md-menu-item>
<md-menu-item headline="Alphabetical"></md-menu-item>
</md-menu>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMount } from 'svelte';
import '@awc-ui/core/define';
let sortRef;
let sortMenuRef;
onMount(() => {
const sort = sortRef;
const sortMenu = sortMenuRef;
sort.addEventListener('mdTrailingClick', function (e) {
if (e.detail.checked) { sortMenu.show(); } else { sortMenu.close(); }
});
sortMenu.addEventListener('mdClose', function () { sort.trailingChecked = false; });
});
</script>
<md-split-button id="sb-a11y-sort" bind:this={sortRef} icon="sort" label="Sort" variant="tonal" haspopup="menu" controls="sb-a11y-sort-menu" menu-label="Sort options"></md-split-button>
<md-split-button icon="favorite" label="Like" variant="outlined" haspopup="false" menu-label="Toggle like"></md-split-button>
<md-split-button icon="save" label="Unavailable" soft-disabled menu-label="More save options"></md-split-button>
<md-menu id="sb-a11y-sort-menu" bind:this={sortMenuRef} anchor="sb-a11y-sort" placement="bottom-end">
<md-menu-item headline="Newest first"></md-menu-item>
<md-menu-item headline="Oldest first"></md-menu-item>
<md-menu-item headline="Alphabetical"></md-menu-item>
</md-menu>RTL — the segments swap order automatically under dir="rtl"; the corner
radii and padding use logical properties, so the outer pill always lands on the
inline-start edge and the split corner on the inline-end edge. The default
chevron (keyboard_arrow_down) is vertical and needs no mirroring — a custom
horizontal glyph does. See RTL.
<div dir="rtl"> <md-split-button icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button></div>The same split buttons in both directions. Nothing is re-authored between
the rows — only dir changes:
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="Edit" menu-label="Toggle menu"></md-split-button>
<md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Save" menu-label="More save options"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="elevated" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>ltr</span>
<div dir="ltr" style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdSplitButton variant="filled" icon="edit" label="Edit" menuLabel="Toggle menu"></MdSplitButton>
<MdSplitButton variant="outlined" icon="add" label="Create" menuLabel="Create options"></MdSplitButton>
<MdSplitButton variant="elevated" icon="save" label="Save" menuLabel="More save options"></MdSplitButton>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>rtl</span>
<div dir="rtl" style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdSplitButton variant="filled" icon="edit" label="تعديل" menuLabel="تبديل القائمة"></MdSplitButton>
<MdSplitButton variant="outlined" icon="add" label="إنشاء" menuLabel="خيارات الإنشاء"></MdSplitButton>
<MdSplitButton variant="elevated" icon="save" label="حفظ" menuLabel="خيارات الحفظ"></MdSplitButton>
</div>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="Edit" menu-label="Toggle menu"></md-split-button>
<md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Save" menu-label="More save options"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="elevated" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="Edit" menu-label="Toggle menu"></md-split-button>
<md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Save" menu-label="More save options"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="elevated" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="Edit" menu-label="Toggle menu"></md-split-button>
<md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button>
<md-split-button variant="elevated" icon="save" label="Save" menu-label="More save options"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="elevated" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>The layout mirrors itself, so the one thing left to get wrong is
trailing-icon. The default keyboard_arrow_down points along the block axis
and reads identically in both directions. Swap in a horizontal glyph and it
now points away from the menu it opens under RTL — compare the rows:
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="tonal" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="add" label="إنشاء" trailing-icon="expand_more" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="save" label="حفظ" trailing-icon="more_vert" menu-label="خيارات الحفظ"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="outlined" icon="edit" label="تعديل" trailing-icon="chevron_right" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" trailing-icon="arrow_forward" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="outlined" icon="save" label="حفظ" trailing-icon="double_arrow" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>correct</span>
<div dir="rtl" style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdSplitButton variant="tonal" icon="edit" label="تعديل" menuLabel="تبديل القائمة"></MdSplitButton>
<MdSplitButton variant="tonal" icon="add" label="إنشاء" trailingIcon="expand_more" menuLabel="خيارات الإنشاء"></MdSplitButton>
<MdSplitButton variant="tonal" icon="save" label="حفظ" trailingIcon="more_vert" menuLabel="خيارات الحفظ"></MdSplitButton>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>wrong</span>
<div dir="rtl" style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdSplitButton variant="outlined" icon="edit" label="تعديل" trailingIcon="chevron_right" menuLabel="تبديل القائمة"></MdSplitButton>
<MdSplitButton variant="outlined" icon="add" label="إنشاء" trailingIcon="arrow_forward" menuLabel="خيارات الإنشاء"></MdSplitButton>
<MdSplitButton variant="outlined" icon="save" label="حفظ" trailingIcon="double_arrow" menuLabel="خيارات الحفظ"></MdSplitButton>
</div>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="tonal" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="add" label="إنشاء" trailing-icon="expand_more" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="save" label="حفظ" trailing-icon="more_vert" menu-label="خيارات الحفظ"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="outlined" icon="edit" label="تعديل" trailing-icon="chevron_right" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" trailing-icon="arrow_forward" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="outlined" icon="save" label="حفظ" trailing-icon="double_arrow" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="tonal" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="add" label="إنشاء" trailing-icon="expand_more" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="save" label="حفظ" trailing-icon="more_vert" menu-label="خيارات الحفظ"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="outlined" icon="edit" label="تعديل" trailing-icon="chevron_right" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" trailing-icon="arrow_forward" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="outlined" icon="save" label="حفظ" trailing-icon="double_arrow" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">correct</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="tonal" icon="edit" label="تعديل" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="add" label="إنشاء" trailing-icon="expand_more" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="save" label="حفظ" trailing-icon="more_vert" menu-label="خيارات الحفظ"></md-split-button>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="outlined" icon="edit" label="تعديل" trailing-icon="chevron_right" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" trailing-icon="arrow_forward" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="outlined" icon="save" label="حفظ" trailing-icon="double_arrow" menu-label="خيارات الحفظ"></md-split-button>
</div>
</div>density="-1…-4" is a local override of the inherited data-density; 0 is the
default value, not an override, so the first row below carries no attribute at
all. The default plus all four rungs, same split button, so the taper is visible
in one place:
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-1" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-1" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-2" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-2" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-3" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-3" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-4" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-4" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>0</span>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}><MdSplitButton variant="filled" icon="save" label="Save" menuLabel="More save options"></MdSplitButton><MdSplitButton variant="outlined" icon="add" label="Create" menuLabel="Create options"></MdSplitButton></div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-1</span>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}><MdSplitButton variant="filled" density="-1" icon="save" label="Save" menuLabel="More save options"></MdSplitButton><MdSplitButton variant="outlined" density="-1" icon="add" label="Create" menuLabel="Create options"></MdSplitButton></div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-2</span>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}><MdSplitButton variant="filled" density="-2" icon="save" label="Save" menuLabel="More save options"></MdSplitButton><MdSplitButton variant="outlined" density="-2" icon="add" label="Create" menuLabel="Create options"></MdSplitButton></div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-3</span>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}><MdSplitButton variant="filled" density="-3" icon="save" label="Save" menuLabel="More save options"></MdSplitButton><MdSplitButton variant="outlined" density="-3" icon="add" label="Create" menuLabel="Create options"></MdSplitButton></div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-4</span>
<div style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}><MdSplitButton variant="filled" density="-4" icon="save" label="Save" menuLabel="More save options"></MdSplitButton><MdSplitButton variant="outlined" density="-4" icon="add" label="Create" menuLabel="Create options"></MdSplitButton></div>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-1" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-1" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-2" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-2" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-3" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-3" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-4" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-4" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-1" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-1" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-2" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-2" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-3" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-3" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-4" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-4" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-1" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-1" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-2" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-2" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-3" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-3" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;"><md-split-button variant="filled" density="-4" icon="save" label="Save" menu-label="More save options"></md-split-button><md-split-button variant="outlined" density="-4" icon="add" label="Create" menu-label="Create options"></md-split-button></div>
</div>Each rung takes 4px off the height — 40, 36, 32, 28, 24 at the default
sm size — and trims the inline padding, the label type and the icon↔label gap
alongside, which pulls the whole control in from 133px wide to 92px. Both
segments shrink together, so the 2px gap between them never breaks.
The glyphs do not taper. Both the leading icon and the chevron are sized
purely from size (18px and 22px at sm), so they stay put at every rung —
which is what keeps the trailing toggle legible as the container closes in on
it. Resize them yourself with --md-split-button-icon-size if you need to.
Set it per instance, or inherit it from an ancestor and let a whole toolbar tighten at once:
<div data-density="-2"> <md-split-button label="Save" icon="save" menu-label="More"></md-split-button></div>The two are independent signals, so they compose without any extra wiring — a wrapper sets the rung for everything inside it, and any one control can take a tighter rung of its own.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="أكثر إحكاما" density="-4" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="افتراضي" style="--md-sys-density-scale: 0;" menu-label="تبديل القائمة"></md-split-button>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<div dir="rtl" data-density="-2" style={{ display: 'flex', gap: '12px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdSplitButton variant="filled" icon="save" label="حفظ" menuLabel="خيارات الحفظ"></MdSplitButton>
<MdSplitButton variant="outlined" icon="add" label="إنشاء" menuLabel="خيارات الإنشاء"></MdSplitButton>
<MdSplitButton variant="tonal" icon="edit" label="أكثر إحكاما" density="-4" menuLabel="تبديل القائمة"></MdSplitButton>
<MdSplitButton variant="tonal" icon="edit" label="افتراضي" style={{ '--md-sys-density-scale': '0' }} menuLabel="تبديل القائمة"></MdSplitButton>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div dir="rtl" data-density="-2" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="أكثر إحكاما" density="-4" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="افتراضي" style="--md-sys-density-scale: 0;" menu-label="تبديل القائمة"></md-split-button>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div dir="rtl" data-density="-2" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="أكثر إحكاما" density="-4" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="افتراضي" style="--md-sys-density-scale: 0;" menu-label="تبديل القائمة"></md-split-button>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display:flex;gap:12px;flex-wrap:wrap;align-items:center;">
<md-split-button variant="filled" icon="save" label="حفظ" menu-label="خيارات الحفظ"></md-split-button>
<md-split-button variant="outlined" icon="add" label="إنشاء" menu-label="خيارات الإنشاء"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="أكثر إحكاما" density="-4" menu-label="تبديل القائمة"></md-split-button>
<md-split-button variant="tonal" icon="edit" label="افتراضي" style="--md-sys-density-scale: 0;" menu-label="تبديل القائمة"></md-split-button>
</div>Density — density="-1…-4" shrinks both segments together and locally
overrides the inherited data-density rung; 0 is the default value, not an
override. See Density.
i18n — translate label (or the slotted text) and menu-label.
Translated labels run longer; prefer full-width with truncation over a label
that wraps.
| Custom property | Purpose | Default |
|---|---|---|
--md-split-button-container-color | Segment background | Per variant — --md-sys-color-primary on filled, transparent on outlined |
--md-split-button-label-color | Label + icon color | Per variant — --md-sys-color-on-primary on filled |
--md-split-button-icon-color | Icon override | Inherits the label color |
--md-split-button-outline-color | outlined border | --md-sys-color-outline |
--md-split-button-container-shape | Outer corner radius | Half the segment height (a pill) |
--md-split-button-icon-size | Leading icon size | Per size — 18px at sm |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-split-button icon="delete" label="Delete" menu-label="More delete options" style="--md-split-button-container-color: var(--md-sys-color-error); --md-split-button-label-color: var(--md-sys-color-on-error); --md-split-button-icon-color: var(--md-sys-color-on-error);"></md-split-button>
<md-split-button icon="save" label="Squared off" menu-label="More save options" style="--md-split-button-container-shape: 6px;"></md-split-button>
<md-split-button variant="outlined" icon="tune" label="Custom outline" menu-label="More options" style="--md-split-button-outline-color: var(--md-sys-color-tertiary); --md-split-button-label-color: var(--md-sys-color-tertiary); --md-split-button-icon-size: 24px;"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSplitButton icon="delete" label="Delete" menuLabel="More delete options" style={{ '--md-split-button-container-color': 'var(--md-sys-color-error)', '--md-split-button-label-color': 'var(--md-sys-color-on-error)', '--md-split-button-icon-color': 'var(--md-sys-color-on-error)' }}></MdSplitButton>
<MdSplitButton icon="save" label="Squared off" menuLabel="More save options" style={{ '--md-split-button-container-shape': '6px' }}></MdSplitButton>
<MdSplitButton variant="outlined" icon="tune" label="Custom outline" menuLabel="More options" style={{ '--md-split-button-outline-color': 'var(--md-sys-color-tertiary)', '--md-split-button-label-color': 'var(--md-sys-color-tertiary)', '--md-split-button-icon-size': '24px' }}></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-split-button icon="delete" label="Delete" menu-label="More delete options" style="--md-split-button-container-color: var(--md-sys-color-error); --md-split-button-label-color: var(--md-sys-color-on-error); --md-split-button-icon-color: var(--md-sys-color-on-error);"></md-split-button>
<md-split-button icon="save" label="Squared off" menu-label="More save options" style="--md-split-button-container-shape: 6px;"></md-split-button>
<md-split-button variant="outlined" icon="tune" label="Custom outline" menu-label="More options" style="--md-split-button-outline-color: var(--md-sys-color-tertiary); --md-split-button-label-color: var(--md-sys-color-tertiary); --md-split-button-icon-size: 24px;"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-split-button icon="delete" label="Delete" menu-label="More delete options" style="--md-split-button-container-color: var(--md-sys-color-error); --md-split-button-label-color: var(--md-sys-color-on-error); --md-split-button-icon-color: var(--md-sys-color-on-error);"></md-split-button>
<md-split-button icon="save" label="Squared off" menu-label="More save options" style="--md-split-button-container-shape: 6px;"></md-split-button>
<md-split-button variant="outlined" icon="tune" label="Custom outline" menu-label="More options" style="--md-split-button-outline-color: var(--md-sys-color-tertiary); --md-split-button-label-color: var(--md-sys-color-tertiary); --md-split-button-icon-size: 24px;"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-split-button icon="delete" label="Delete" menu-label="More delete options" style="--md-split-button-container-color: var(--md-sys-color-error); --md-split-button-label-color: var(--md-sys-color-on-error); --md-split-button-icon-color: var(--md-sys-color-on-error);"></md-split-button>
<md-split-button icon="save" label="Squared off" menu-label="More save options" style="--md-split-button-container-shape: 6px;"></md-split-button>
<md-split-button variant="outlined" icon="tune" label="Custom outline" menu-label="More options" style="--md-split-button-outline-color: var(--md-sys-color-tertiary); --md-split-button-label-color: var(--md-sys-color-tertiary); --md-split-button-icon-size: 24px;"></md-split-button>Seven CSS parts are exposed: leading, leading-state-layer, icon, label,
trailing, trailing-state-layer and trailing-icon — enough to reach either
segment, its state overlay and its glyph independently.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<style>
.sb-parts-demo::part(trailing) { min-inline-size: 56px; }
.sb-parts-demo::part(label) { text-transform: uppercase; letter-spacing: .08em; }
.sb-parts-demo::part(trailing-icon) { color: var(--md-sys-color-tertiary); }
</style>
<md-split-button class="sb-parts-demo" variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>
<md-split-button variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSplitButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.sb-parts-demo::part(trailing) { min-inline-size: 56px; }
.sb-parts-demo::part(label) { text-transform: uppercase; letter-spacing: .08em; }
.sb-parts-demo::part(trailing-icon) { color: var(--md-sys-color-tertiary); }
</style>
<MdSplitButton className="sb-parts-demo" variant="outlined" icon="download" label="Export" menuLabel="Export options"></MdSplitButton>
<MdSplitButton variant="outlined" icon="download" label="Export" menuLabel="Export options"></MdSplitButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<style>
.sb-parts-demo::part(trailing) { min-inline-size: 56px; }
.sb-parts-demo::part(label) { text-transform: uppercase; letter-spacing: .08em; }
.sb-parts-demo::part(trailing-icon) { color: var(--md-sys-color-tertiary); }
</style>
<md-split-button class="sb-parts-demo" variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>
<md-split-button variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<style>
.sb-parts-demo::part(trailing) { min-inline-size: 56px; }
.sb-parts-demo::part(label) { text-transform: uppercase; letter-spacing: .08em; }
.sb-parts-demo::part(trailing-icon) { color: var(--md-sys-color-tertiary); }
</style>
<md-split-button class="sb-parts-demo" variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>
<md-split-button variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<style>
.sb-parts-demo::part(trailing) { min-inline-size: 56px; }
.sb-parts-demo::part(label) { text-transform: uppercase; letter-spacing: .08em; }
.sb-parts-demo::part(trailing-icon) { color: var(--md-sys-color-tertiary); }
</style>
<md-split-button class="sb-parts-demo" variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>
<md-split-button variant="outlined" icon="download" label="Export" menu-label="Export options"></md-split-button>md-split-button::part(trailing) { min-inline-size: 48px;}md-button ·
md-button-group ·
md-menu ·
md-menu-item ·
md-segmented-button ·
md-icon-button ·
md-ripple
md-split-buttonTwo artefacts to give your AI agent so it generates correct UI with this component. The per-component spec answers "how do I use this exact tag?". The main-llm spec answers "which tag should I pick in the first place?".
md-split-button spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
System-prompt preamble · decision matrix · token reference · page recipes · anti-patterns. Paste into the system prompt at the start of a piece of work.