md-segmented-button-set 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.
A choice between 2–5 exclusive options, all visible at once. Two elements
work as one control: <md-segmented-button-set> owns the selection and stamps
each child with its position, and <md-segmented-button> renders one segment —
value, optional icon, label, and the selected checkmark.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Calendar view">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="Calendar view">
<MdSegmentedButton value="day" label="Day" selected></MdSegmentedButton>
<MdSegmentedButton value="week" label="Week"></MdSegmentedButton>
<MdSegmentedButton value="month" label="Month"></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="Calendar view">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="Calendar view">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>
</template><script>
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Calendar view">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-segmented-button-set 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-segmented-button-set) ─── -->
<script type="module">
import '@awc-ui/core/components/md-segmented-button-set';
</script>
<md-segmented-button-set></md-segmented-button-set>// ─── 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 { MdSegmentedButtonSet } from '@awc-ui/react';
export function Example() {
return <MdSegmentedButtonSet></MdSegmentedButtonSet>;
}
// ─── Option B: single import (tree-shake to only md-segmented-button-set) ───
// 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-segmented-button-set';
export function ExampleTreeShaken() {
return <md-segmented-button-set></md-segmented-button-set>;
}// ─── 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-segmented-button-set></md-segmented-button-set>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-segmented-button-set'` in main.ts.
import { Component } from '@angular/core';
import { MdSegmentedButtonSet } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdSegmentedButtonSet],
template: `<md-segmented-button-set></md-segmented-button-set>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdSegmentedButtonSet } from '@awc-ui/vue';
</script>
<template>
<MdSegmentedButtonSet></MdSegmentedButtonSet>
</template>
<!-- ─── Option B: single import (tree-shake to only md-segmented-button-set) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-segmented-button-set';
</script>
<template>
<md-segmented-button-set></md-segmented-button-set>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-segmented-button-set></md-segmented-button-set>
<!-- ─── Option B: single import (tree-shake to only md-segmented-button-set) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-segmented-button-set';
</script>
<md-segmented-button-set></md-segmented-button-set>multiselect).| Situation | Use instead |
|---|---|
| More than five choices | md-chip set, md-select, or md-menu |
| Navigating between destinations or panels | md-tabs / md-navigation-bar |
| Running actions rather than choosing a state | md-button-group |
| A form field that must submit | md-radio / md-checkbox |
| One default action plus variants | md-split-button |
| Choosing from a long or dynamic list | md-select |
| Free-form multi-select of many tags | md-multi-select, md-chip |
The set is an inline-grid with grid-auto-flow: column and
grid-auto-columns: 1fr, so segments must be direct, real children: they are
the grid items, and that is what gives every segment the same width no matter how
long its label is. A <div> wrapper for layout still gets discovered — the set
stamps its children with querySelectorAll('md-segmented-button'), a descendant
query — but the wrapper becomes the single grid item and the equal columns are
lost.
| Need | Where it goes |
|---|---|
| The initial selection | selected on a child. The set has no value prop |
| Single vs multi | multiselect on the set |
| Density | density on the set (cascades) or on a child (overrides) |
| The accessible group name | aria-label on the set |
| Per-segment identity | value on each child |
Same three labels, same set, one wrapped in a <div>. The top row’s columns are
equal; the bottom row’s collapse to each label’s intrinsic width:
<!-- 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>
<md-segmented-button-set aria-label="Direct children">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<md-segmented-button-set aria-label="Wrapped children">
<div style="display:flex;">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</div>
</md-segmented-button-set>
</div>import { MdSegmentedButton, MdSegmentedButtonSet } 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>
<MdSegmentedButtonSet aria-label="Direct children">
<MdSegmentedButton value="d" label="Day" selected></MdSegmentedButton>
<MdSegmentedButton value="w" label="Week"></MdSegmentedButton>
<MdSegmentedButton value="y" label="Last 12 months"></MdSegmentedButton>
</MdSegmentedButtonSet>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>wrong</span>
<MdSegmentedButtonSet aria-label="Wrapped children">
<div style={{ display: 'flex' }}>
<MdSegmentedButton value="d" label="Day" selected></MdSegmentedButton>
<MdSegmentedButton value="w" label="Week"></MdSegmentedButton>
<MdSegmentedButton value="y" label="Last 12 months"></MdSegmentedButton>
</div>
</MdSegmentedButtonSet>
</div>
</>
);
}// 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>
<md-segmented-button-set aria-label="Direct children">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<md-segmented-button-set aria-label="Wrapped children">
<div style="display:flex;">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</div>
</md-segmented-button-set>
</div><script setup>
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>
<md-segmented-button-set aria-label="Direct children">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<md-segmented-button-set aria-label="Wrapped children">
<div style="display:flex;">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</div>
</md-segmented-button-set>
</div>
</template><script>
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>
<md-segmented-button-set aria-label="Direct children">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<md-segmented-button-set aria-label="Wrapped children">
<div style="display:flex;">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="y" label="Last 12 months"></md-segmented-button>
</div>
</md-segmented-button-set>
</div>Default mode. role="radiogroup", one selection at a time.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Time range">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="m" label="Month"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Answer">
<md-segmented-button value="yes" label="Yes" selected></md-segmented-button>
<md-segmented-button value="no" label="No"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Rating filter">
<md-segmented-button value="1" label="All" selected></md-segmented-button>
<md-segmented-button value="2" label="Recent"></md-segmented-button>
<md-segmented-button value="3" label="Top"></md-segmented-button>
<md-segmented-button value="4" label="Mine"></md-segmented-button>
<md-segmented-button value="5" label="Draft"></md-segmented-button>
</md-segmented-button-set>import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="Time range">
<MdSegmentedButton value="d" label="Day" selected></MdSegmentedButton>
<MdSegmentedButton value="w" label="Week"></MdSegmentedButton>
<MdSegmentedButton value="m" label="Month"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Answer">
<MdSegmentedButton value="yes" label="Yes" selected></MdSegmentedButton>
<MdSegmentedButton value="no" label="No"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Rating filter">
<MdSegmentedButton value="1" label="All" selected></MdSegmentedButton>
<MdSegmentedButton value="2" label="Recent"></MdSegmentedButton>
<MdSegmentedButton value="3" label="Top"></MdSegmentedButton>
<MdSegmentedButton value="4" label="Mine"></MdSegmentedButton>
<MdSegmentedButton value="5" label="Draft"></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="Time range">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="m" label="Month"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Answer">
<md-segmented-button value="yes" label="Yes" selected></md-segmented-button>
<md-segmented-button value="no" label="No"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Rating filter">
<md-segmented-button value="1" label="All" selected></md-segmented-button>
<md-segmented-button value="2" label="Recent"></md-segmented-button>
<md-segmented-button value="3" label="Top"></md-segmented-button>
<md-segmented-button value="4" label="Mine"></md-segmented-button>
<md-segmented-button value="5" label="Draft"></md-segmented-button>
</md-segmented-button-set><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="Time range">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="m" label="Month"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Answer">
<md-segmented-button value="yes" label="Yes" selected></md-segmented-button>
<md-segmented-button value="no" label="No"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Rating filter">
<md-segmented-button value="1" label="All" selected></md-segmented-button>
<md-segmented-button value="2" label="Recent"></md-segmented-button>
<md-segmented-button value="3" label="Top"></md-segmented-button>
<md-segmented-button value="4" label="Mine"></md-segmented-button>
<md-segmented-button value="5" label="Draft"></md-segmented-button>
</md-segmented-button-set>
</template><script>
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Time range">
<md-segmented-button value="d" label="Day" selected></md-segmented-button>
<md-segmented-button value="w" label="Week"></md-segmented-button>
<md-segmented-button value="m" label="Month"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Answer">
<md-segmented-button value="yes" label="Yes" selected></md-segmented-button>
<md-segmented-button value="no" label="No"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Rating filter">
<md-segmented-button value="1" label="All" selected></md-segmented-button>
<md-segmented-button value="2" label="Recent"></md-segmented-button>
<md-segmented-button value="3" label="Top"></md-segmented-button>
<md-segmented-button value="4" label="Mine"></md-segmented-button>
<md-segmented-button value="5" label="Draft"></md-segmented-button>
</md-segmented-button-set>multiselect on the set switches role to group and allows several
selections at once.
<!-- 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-segmented-button-set multiselect aria-label="Filters">
<md-segmented-button value="unread" label="Unread" icon="mark_email_unread" selected></md-segmented-button>
<md-segmented-button value="starred" label="Starred" icon="star"></md-segmented-button>
<md-segmented-button value="mine" label="Mine" icon="person" selected></md-segmented-button>
</md-segmented-button-set>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet multiselect aria-label="Filters">
<MdSegmentedButton value="unread" label="Unread" icon="mark_email_unread" selected></MdSegmentedButton>
<MdSegmentedButton value="starred" label="Starred" icon="star"></MdSegmentedButton>
<MdSegmentedButton value="mine" label="Mine" icon="person" selected></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set multiselect aria-label="Filters">
<md-segmented-button value="unread" label="Unread" icon="mark_email_unread" selected></md-segmented-button>
<md-segmented-button value="starred" label="Starred" icon="star"></md-segmented-button>
<md-segmented-button value="mine" label="Mine" icon="person" selected></md-segmented-button>
</md-segmented-button-set><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set multiselect aria-label="Filters">
<md-segmented-button value="unread" label="Unread" icon="mark_email_unread" selected></md-segmented-button>
<md-segmented-button value="starred" label="Starred" icon="star"></md-segmented-button>
<md-segmented-button value="mine" label="Mine" icon="person" selected></md-segmented-button>
</md-segmented-button-set>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-segmented-button-set multiselect aria-label="Filters">
<md-segmented-button value="unread" label="Unread" icon="mark_email_unread" selected></md-segmented-button>
<md-segmented-button value="starred" label="Starred" icon="star"></md-segmented-button>
<md-segmented-button value="mine" label="Mine" icon="person" selected></md-segmented-button>
</md-segmented-button-set>Use one label type across the whole set — M3 explicitly warns against mixing
an icon-only segment with text segments. An icon-only segment carries no
accessible name of its own, so give it an aria-label.
<!-- 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-segmented-button-set aria-label="Layout">
<md-segmented-button value="list" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="grid" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Alignment">
<md-segmented-button value="l" icon="format_align_left" aria-label="Align left" selected></md-segmented-button>
<md-segmented-button value="c" icon="format_align_center" aria-label="Align center"></md-segmented-button>
<md-segmented-button value="r" icon="format_align_right" aria-label="Align right"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Favourites">
<md-segmented-button value="all" label="All" selected></md-segmented-button>
<md-segmented-button value="star" label="Starred">
<svg slot="icon" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-segmented-button>
</md-segmented-button-set>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="Layout">
<MdSegmentedButton value="list" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="grid" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Alignment">
<MdSegmentedButton value="l" icon="format_align_left" aria-label="Align left" selected></MdSegmentedButton>
<MdSegmentedButton value="c" icon="format_align_center" aria-label="Align center"></MdSegmentedButton>
<MdSegmentedButton value="r" icon="format_align_right" aria-label="Align right"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Favourites">
<MdSegmentedButton value="all" label="All" selected></MdSegmentedButton>
<MdSegmentedButton value="star" label="Starred">
<svg slot="icon" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="Layout">
<md-segmented-button value="list" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="grid" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Alignment">
<md-segmented-button value="l" icon="format_align_left" aria-label="Align left" selected></md-segmented-button>
<md-segmented-button value="c" icon="format_align_center" aria-label="Align center"></md-segmented-button>
<md-segmented-button value="r" icon="format_align_right" aria-label="Align right"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Favourites">
<md-segmented-button value="all" label="All" selected></md-segmented-button>
<md-segmented-button value="star" label="Starred">
<svg slot="icon" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-segmented-button>
</md-segmented-button-set><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="Layout">
<md-segmented-button value="list" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="grid" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Alignment">
<md-segmented-button value="l" icon="format_align_left" aria-label="Align left" selected></md-segmented-button>
<md-segmented-button value="c" icon="format_align_center" aria-label="Align center"></md-segmented-button>
<md-segmented-button value="r" icon="format_align_right" aria-label="Align right"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Favourites">
<md-segmented-button value="all" label="All" selected></md-segmented-button>
<md-segmented-button value="star" label="Starred">
<svg slot="icon" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-segmented-button>
</md-segmented-button-set>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Layout">
<md-segmented-button value="list" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="grid" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Alignment">
<md-segmented-button value="l" icon="format_align_left" aria-label="Align left" selected></md-segmented-button>
<md-segmented-button value="c" icon="format_align_center" aria-label="Align center"></md-segmented-button>
<md-segmented-button value="r" icon="format_align_right" aria-label="Align right"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Favourites">
<md-segmented-button value="all" label="All" selected></md-segmented-button>
<md-segmented-button value="star" label="Starred">
<svg slot="icon" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-segmented-button>
</md-segmented-button-set>The icon prop and the checkmark share one element — selecting an
icon+label segment swaps the glyph for the check. The icon slot does not:
it renders alongside, so a selected slotted segment shows the checkmark and
your glyph. Add no-checkmark to that segment if you want the glyph to stand
alone — and read The checkmark first, because that trade is an
accessibility one.
The selected segment shows a checkmark by default. That is what conveys
selection non-visually — no-checkmark removes the cue and leaves colour
alone, which is a real accessibility regression in multiselect.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="With checkmark">
<md-segmented-button value="a" label="Selected" selected></md-segmented-button>
<md-segmented-button value="b" label="Unselected"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Without checkmark">
<md-segmented-button value="a" label="Selected" selected no-checkmark></md-segmented-button>
<md-segmented-button value="b" label="Unselected" no-checkmark></md-segmented-button>
</md-segmented-button-set>import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="With checkmark">
<MdSegmentedButton value="a" label="Selected" selected></MdSegmentedButton>
<MdSegmentedButton value="b" label="Unselected"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Without checkmark">
<MdSegmentedButton value="a" label="Selected" selected no-checkmark></MdSegmentedButton>
<MdSegmentedButton value="b" label="Unselected" no-checkmark></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="With checkmark">
<md-segmented-button value="a" label="Selected" selected></md-segmented-button>
<md-segmented-button value="b" label="Unselected"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Without checkmark">
<md-segmented-button value="a" label="Selected" selected no-checkmark></md-segmented-button>
<md-segmented-button value="b" label="Unselected" no-checkmark></md-segmented-button>
</md-segmented-button-set><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="With checkmark">
<md-segmented-button value="a" label="Selected" selected></md-segmented-button>
<md-segmented-button value="b" label="Unselected"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Without checkmark">
<md-segmented-button value="a" label="Selected" selected no-checkmark></md-segmented-button>
<md-segmented-button value="b" label="Unselected" no-checkmark></md-segmented-button>
</md-segmented-button-set>
</template><script>
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="With checkmark">
<md-segmented-button value="a" label="Selected" selected></md-segmented-button>
<md-segmented-button value="b" label="Unselected"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Without checkmark">
<md-segmented-button value="a" label="Selected" selected no-checkmark></md-segmented-button>
<md-segmented-button value="b" label="Unselected" no-checkmark></md-segmented-button>
</md-segmented-button-set>disabled leaves the tab order; soft-disabled stays focusable so an
unavailable choice is still discoverable.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="States">
<md-segmented-button value="a" label="Enabled" selected></md-segmented-button>
<md-segmented-button value="b" label="Disabled" disabled></md-segmented-button>
<md-segmented-button value="c" label="Soft-disabled" soft-disabled></md-segmented-button>
</md-segmented-button-set>import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="States">
<MdSegmentedButton value="a" label="Enabled" selected></MdSegmentedButton>
<MdSegmentedButton value="b" label="Disabled" disabled></MdSegmentedButton>
<MdSegmentedButton value="c" label="Soft-disabled" soft-disabled></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="States">
<md-segmented-button value="a" label="Enabled" selected></md-segmented-button>
<md-segmented-button value="b" label="Disabled" disabled></md-segmented-button>
<md-segmented-button value="c" label="Soft-disabled" soft-disabled></md-segmented-button>
</md-segmented-button-set><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="States">
<md-segmented-button value="a" label="Enabled" selected></md-segmented-button>
<md-segmented-button value="b" label="Disabled" disabled></md-segmented-button>
<md-segmented-button value="c" label="Soft-disabled" soft-disabled></md-segmented-button>
</md-segmented-button-set>
</template><script>
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="States">
<md-segmented-button value="a" label="Enabled" selected></md-segmented-button>
<md-segmented-button value="b" label="Disabled" disabled></md-segmented-button>
<md-segmented-button value="c" label="Soft-disabled" soft-disabled></md-segmented-button>
</md-segmented-button-set>Listen on the set, never on the children.
| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdChange (set) | no | string[] — values of all selected segments | Every activation of a segment (pointer, Enter, Space, arrow keys in single-select) |
mdSegmentClick (segment) | no | { value, selected } | Internal plumbing — the set listens for it and re-emits mdChange |
mdChange is an activation signal, not a diff. It fires on every click, even
one that changes nothing — re-clicking the already-selected segment in
single-select still emits, with the same array as before. And like the platform’s
own change, it does not fire on a programmatic change: setting
seg.selected = true in code emits nothing, because the set only ever emits from
its mdSegmentClick listener. If your own code changes the selection, your own
code already knows. De-duplicate in your handler if you need change-only
semantics.
Both sets below share one delegated mdChange listener. Watch the multi-select
row emit a growing array — and shrink to an empty one when you deselect its last
segment, which single-select can never do:
<md-segmented-button-set id="view" aria-label="Calendar view">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>
<script type="module">
document.getElementById('view').addEventListener('mdChange', (e) => {
const [view] = e.detail; // string[] of every selected value
if (!view) return; // defensive: multiselect can be empty
setCalendarView(view);
});
</script>import { MdSegmentedButtonSet, MdSegmentedButton } from '@awc-ui/react';
import { useState } from 'react';
export function CalendarView() {
const [view, setView] = useState('day');
return (
<MdSegmentedButtonSet
aria-label="Calendar view"
onMdChange={(e) => {
const [next] = e.detail;
if (next) setView(next);
}}
>
<MdSegmentedButton value="day" label="Day" selected={view === 'day'} />
<MdSegmentedButton value="week" label="Week" selected={view === 'week'} />
<MdSegmentedButton value="month" label="Month" selected={view === 'month'} />
</MdSegmentedButtonSet>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-calendar-view',
template: `
<md-segmented-button-set aria-label="Calendar view" (mdChange)="onChange($event)">
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>
`,
})
export class CalendarViewComponent {
view = 'day';
onChange(e: CustomEvent<string[]>) {
const [next] = e.detail;
if (next) this.view = next;
}
}<script setup lang="ts">
import { ref } from 'vue';
const view = ref('day');
function onChange(e: CustomEvent) {
const [next] = e.detail;
if (next) view.value = next;
}
</script>
<template>
<md-segmented-button-set aria-label="Calendar view" @mdChange="onChange">
<md-segmented-button value="day" label="Day" selected />
<md-segmented-button value="week" label="Week" />
<md-segmented-button value="month" label="Month" />
</md-segmented-button-set>
</template><script lang="ts">
let view = 'day';
function onChange(e: CustomEvent) {
const [next] = e.detail;
if (next) view = next;
}
</script>
<md-segmented-button-set aria-label="Calendar view" on:mdChange={onChange}>
<md-segmented-button value="day" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" label="Week"></md-segmented-button>
<md-segmented-button value="month" label="Month"></md-segmented-button>
</md-segmented-button-set>The set element — <md-segmented-button-set>.
| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
multiselect | multiselect | boolean | false | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
(default) | — |
role="radiogroup" in single-select and role="group" in
multiselect. Give the set an aria-label naming what it controls — the
children name themselves via their label.aria-label to each.no-checkmark, especially in multiselect.disabled leaves the tab order; soft-disabled stays focusable.disabled
segments. In single-select, arrowing also selects — the WAI-ARIA
radiogroup pattern. Enter and Space activate.<!-- 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-segmented-button-set aria-label="Transport">
<md-segmented-button value="car" icon="directions_car" label="Car" selected></md-segmented-button>
<md-segmented-button value="bus" icon="directions_bus" label="Bus"></md-segmented-button>
<md-segmented-button value="rail" icon="train" label="Rail" disabled></md-segmented-button>
<md-segmented-button value="bike" icon="pedal_bike" label="Bike"></md-segmented-button>
</md-segmented-button-set>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="Transport">
<MdSegmentedButton value="car" icon="directions_car" label="Car" selected></MdSegmentedButton>
<MdSegmentedButton value="bus" icon="directions_bus" label="Bus"></MdSegmentedButton>
<MdSegmentedButton value="rail" icon="train" label="Rail" disabled></MdSegmentedButton>
<MdSegmentedButton value="bike" icon="pedal_bike" label="Bike"></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="Transport">
<md-segmented-button value="car" icon="directions_car" label="Car" selected></md-segmented-button>
<md-segmented-button value="bus" icon="directions_bus" label="Bus"></md-segmented-button>
<md-segmented-button value="rail" icon="train" label="Rail" disabled></md-segmented-button>
<md-segmented-button value="bike" icon="pedal_bike" label="Bike"></md-segmented-button>
</md-segmented-button-set><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="Transport">
<md-segmented-button value="car" icon="directions_car" label="Car" selected></md-segmented-button>
<md-segmented-button value="bus" icon="directions_bus" label="Bus"></md-segmented-button>
<md-segmented-button value="rail" icon="train" label="Rail" disabled></md-segmented-button>
<md-segmented-button value="bike" icon="pedal_bike" label="Bike"></md-segmented-button>
</md-segmented-button-set>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Transport">
<md-segmented-button value="car" icon="directions_car" label="Car" selected></md-segmented-button>
<md-segmented-button value="bus" icon="directions_bus" label="Bus"></md-segmented-button>
<md-segmented-button value="rail" icon="train" label="Rail" disabled></md-segmented-button>
<md-segmented-button value="bike" icon="pedal_bike" label="Bike"></md-segmented-button>
</md-segmented-button-set>RTL — the set lays its segments out with grid-auto-flow: column, and the
end caps use logical corner properties (border-start-start-radius and
friends), so segment order and the rounding both flip under dir="rtl" with
nothing re-authored. There is no mirror-icon prop here: a directional
glyph has to be swapped by you. See RTL.
<div dir="rtl"> <md-segmented-button-set aria-label="العرض"> <md-segmented-button value="day" label="يوم" selected></md-segmented-button> <md-segmented-button value="week" label="أسبوع"></md-segmented-button> </md-segmented-button-set></div>The same set in both directions. Only dir changes between these two rows —
the selected end cap moves to the other end on 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 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">
<md-segmented-button-set aria-label="View">
<md-segmented-button value="day" icon="today" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="Week"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="Month"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl">
<md-segmented-button-set aria-label="العرض">
<md-segmented-button value="day" icon="today" label="يوم" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="أسبوع"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="شهر"></md-segmented-button>
</md-segmented-button-set>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } 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">
<MdSegmentedButtonSet aria-label="View">
<MdSegmentedButton value="day" icon="today" label="Day" selected></MdSegmentedButton>
<MdSegmentedButton value="week" icon="date_range" label="Week"></MdSegmentedButton>
<MdSegmentedButton value="month" icon="calendar_month" label="Month"></MdSegmentedButton>
</MdSegmentedButtonSet>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>rtl</span>
<div dir="rtl">
<MdSegmentedButtonSet aria-label="العرض">
<MdSegmentedButton value="day" icon="today" label="يوم" selected></MdSegmentedButton>
<MdSegmentedButton value="week" icon="date_range" label="أسبوع"></MdSegmentedButton>
<MdSegmentedButton value="month" icon="calendar_month" label="شهر"></MdSegmentedButton>
</MdSegmentedButtonSet>
</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">
<md-segmented-button-set aria-label="View">
<md-segmented-button value="day" icon="today" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="Week"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="Month"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl">
<md-segmented-button-set aria-label="العرض">
<md-segmented-button value="day" icon="today" label="يوم" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="أسبوع"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="شهر"></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="View">
<md-segmented-button value="day" icon="today" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="Week"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="Month"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl">
<md-segmented-button-set aria-label="العرض">
<md-segmented-button value="day" icon="today" label="يوم" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="أسبوع"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="شهر"></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="View">
<md-segmented-button value="day" icon="today" label="Day" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="Week"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="Month"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl">
<md-segmented-button-set aria-label="العرض">
<md-segmented-button value="day" icon="today" label="يوم" selected></md-segmented-button>
<md-segmented-button value="week" icon="date_range" label="أسبوع"></md-segmented-button>
<md-segmented-button value="month" icon="calendar_month" label="شهر"></md-segmented-button>
</md-segmented-button-set>
</div>
</div>Layout mirrors itself; a glyph does not. A chevron or an arrow still points the
LTR way under dir="rtl", so pick the mirrored Material Symbol yourself
(chevron_left for “next”, arrow_back for “forward”). Non-directional glyphs
— today, star, person — need nothing:
<!-- 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">
<md-segmented-button-set aria-label="التنقل الصحيح">
<md-segmented-button value="prev" icon="chevron_right" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_left" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl">
<md-segmented-button-set aria-label="التنقل الخاطئ">
<md-segmented-button value="prev" icon="chevron_left" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_right" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } 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">
<MdSegmentedButtonSet aria-label="التنقل الصحيح">
<MdSegmentedButton value="prev" icon="chevron_right" label="السابق" selected></MdSegmentedButton>
<MdSegmentedButton value="next" icon="chevron_left" label="التالي"></MdSegmentedButton>
<MdSegmentedButton value="star" icon="star" label="مميز"></MdSegmentedButton>
</MdSegmentedButtonSet>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>wrong</span>
<div dir="rtl">
<MdSegmentedButtonSet aria-label="التنقل الخاطئ">
<MdSegmentedButton value="prev" icon="chevron_left" label="السابق" selected></MdSegmentedButton>
<MdSegmentedButton value="next" icon="chevron_right" label="التالي"></MdSegmentedButton>
<MdSegmentedButton value="star" icon="star" label="مميز"></MdSegmentedButton>
</MdSegmentedButtonSet>
</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">
<md-segmented-button-set aria-label="التنقل الصحيح">
<md-segmented-button value="prev" icon="chevron_right" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_left" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl">
<md-segmented-button-set aria-label="التنقل الخاطئ">
<md-segmented-button value="prev" icon="chevron_left" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_right" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="التنقل الصحيح">
<md-segmented-button value="prev" icon="chevron_right" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_left" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl">
<md-segmented-button-set aria-label="التنقل الخاطئ">
<md-segmented-button value="prev" icon="chevron_left" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_right" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="التنقل الصحيح">
<md-segmented-button value="prev" icon="chevron_right" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_left" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">wrong</span>
<div dir="rtl">
<md-segmented-button-set aria-label="التنقل الخاطئ">
<md-segmented-button value="prev" icon="chevron_left" label="السابق" selected></md-segmented-button>
<md-segmented-button value="next" icon="chevron_right" label="التالي"></md-segmented-button>
<md-segmented-button value="star" icon="star" label="مميز"></md-segmented-button>
</md-segmented-button-set>
</div>
</div>density on the set cascades to every segment, so the row stays uniform.
The rungs map to concrete heights:
| Rung | Height |
|---|---|
0 | 40px |
-1 | 36px |
-2 | 32px |
-3 | 28px |
-4 | 24px |
<!-- 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%;display:grid;grid-template-columns:auto 1fr;gap:12px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-segmented-button-set density="0" aria-label="Density 0">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-segmented-button-set density="-1" aria-label="Density -1">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-segmented-button-set density="-2" aria-label="Density -2">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-segmented-button-set density="-3" aria-label="Density -3">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-segmented-button-set density="-4" aria-label="Density -4">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ inlineSize: '100%', display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '12px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>0</span>
<MdSegmentedButtonSet density="0" aria-label="Density 0">
<MdSegmentedButton value="l" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="g" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-1</span>
<MdSegmentedButtonSet density="-1" aria-label="Density -1">
<MdSegmentedButton value="l" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="g" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-2</span>
<MdSegmentedButtonSet density="-2" aria-label="Density -2">
<MdSegmentedButton value="l" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="g" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-3</span>
<MdSegmentedButtonSet density="-3" aria-label="Density -3">
<MdSegmentedButton value="l" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="g" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-4</span>
<MdSegmentedButtonSet density="-4" aria-label="Density -4">
<MdSegmentedButton value="l" icon="view_list" label="List" selected></MdSegmentedButton>
<MdSegmentedButton value="g" icon="grid_view" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
</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%;display:grid;grid-template-columns:auto 1fr;gap:12px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-segmented-button-set density="0" aria-label="Density 0">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-segmented-button-set density="-1" aria-label="Density -1">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-segmented-button-set density="-2" aria-label="Density -2">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-segmented-button-set density="-3" aria-label="Density -3">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-segmented-button-set density="-4" aria-label="Density -4">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
</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%;display:grid;grid-template-columns:auto 1fr;gap:12px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-segmented-button-set density="0" aria-label="Density 0">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-segmented-button-set density="-1" aria-label="Density -1">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-segmented-button-set density="-2" aria-label="Density -2">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-segmented-button-set density="-3" aria-label="Density -3">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-segmented-button-set density="-4" aria-label="Density -4">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
</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%;display:grid;grid-template-columns:auto 1fr;gap:12px 16px;align-items:center;">
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<md-segmented-button-set density="0" aria-label="Density 0">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<md-segmented-button-set density="-1" aria-label="Density -1">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<md-segmented-button-set density="-2" aria-label="Density -2">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<md-segmented-button-set density="-3" aria-label="Density -3">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<span style="inline-size:3.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<md-segmented-button-set density="-4" aria-label="Density -4">
<md-segmented-button value="l" icon="view_list" label="List" selected></md-segmented-button>
<md-segmented-button value="g" icon="grid_view" label="Grid"></md-segmented-button>
</md-segmented-button-set>
</div>They are independent signals and compose without extra wiring — a global
data-density ancestor drives the same --md-sys-density-scale the density
prop does:
<!-- 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">
<md-segmented-button-set aria-label="المرشحات" multiselect>
<md-segmented-button value="unread" icon="mark_email_unread" label="غير مقروء" selected></md-segmented-button>
<md-segmented-button value="starred" icon="star" label="مميز"></md-segmented-button>
<md-segmented-button value="mine" icon="person" label="لي" selected></md-segmented-button>
</md-segmented-button-set>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<div dir="rtl" data-density="-2">
<MdSegmentedButtonSet aria-label="المرشحات" multiselect>
<MdSegmentedButton value="unread" icon="mark_email_unread" label="غير مقروء" selected></MdSegmentedButton>
<MdSegmentedButton value="starred" icon="star" label="مميز"></MdSegmentedButton>
<MdSegmentedButton value="mine" icon="person" label="لي" selected></MdSegmentedButton>
</MdSegmentedButtonSet>
</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">
<md-segmented-button-set aria-label="المرشحات" multiselect>
<md-segmented-button value="unread" icon="mark_email_unread" label="غير مقروء" selected></md-segmented-button>
<md-segmented-button value="starred" icon="star" label="مميز"></md-segmented-button>
<md-segmented-button value="mine" icon="person" label="لي" selected></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="المرشحات" multiselect>
<md-segmented-button value="unread" icon="mark_email_unread" label="غير مقروء" selected></md-segmented-button>
<md-segmented-button value="starred" icon="star" label="مميز"></md-segmented-button>
<md-segmented-button value="mine" icon="person" label="لي" selected></md-segmented-button>
</md-segmented-button-set>
</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">
<md-segmented-button-set aria-label="المرشحات" multiselect>
<md-segmented-button value="unread" icon="mark_email_unread" label="غير مقروء" selected></md-segmented-button>
<md-segmented-button value="starred" icon="star" label="مميز"></md-segmented-button>
<md-segmented-button value="mine" icon="person" label="لي" selected></md-segmented-button>
</md-segmented-button-set>
</div>Density — set density on the set so every segment matches; the same
rung on a child overrides the cascaded one. See Density.
i18n — translate the child labels; they come straight from your i18n
layer, and lang/dir are inherited from any ancestor. Localize each icon-only
segment’s aria-label and the set’s aria-label too. Translated labels vary in
length and M3 asks for similar-length, non-wrapping labels, so re-check the set
per locale.
The set exposes no custom properties of its own — theme the children. Apply
the properties on md-segmented-button, or on md-segmented-button-set to
cascade to every segment.
| Custom property | Purpose | Default |
|---|---|---|
--md-segmented-button-container-color | Unselected background | transparent |
--md-segmented-button-selected-container-color | Selected background | secondary-container |
--md-segmented-button-label-color | Unselected label/icon color | on-surface |
--md-segmented-button-selected-label-color | Selected label/icon color | on-secondary-container |
--md-segmented-button-outline-color | Divider / outline | outline |
--md-segmented-button-container-shape | End-cap radius | shape-corner-full |
--md-segmented-button-icon-size | Glyph size | 18px, tapering with density |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Themed" style="--md-segmented-button-selected-container-color: var(--md-sys-color-tertiary-container); --md-segmented-button-selected-label-color: var(--md-sys-color-on-tertiary-container); --md-segmented-button-outline-color: var(--md-sys-color-tertiary);">
<md-segmented-button value="a" label="Tertiary" selected></md-segmented-button>
<md-segmented-button value="b" label="Tinted"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Squared" style="--md-segmented-button-container-shape: 6px;">
<md-segmented-button value="a" label="Squared" selected></md-segmented-button>
<md-segmented-button value="b" label="Off"></md-segmented-button>
</md-segmented-button-set>import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSegmentedButtonSet aria-label="Themed" style={{ '--md-segmented-button-selected-container-color': 'var(--md-sys-color-tertiary-container)', '--md-segmented-button-selected-label-color': 'var(--md-sys-color-on-tertiary-container)', '--md-segmented-button-outline-color': 'var(--md-sys-color-tertiary)' }}>
<MdSegmentedButton value="a" label="Tertiary" selected></MdSegmentedButton>
<MdSegmentedButton value="b" label="Tinted"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet aria-label="Squared" style={{ '--md-segmented-button-container-shape': '6px' }}>
<MdSegmentedButton value="a" label="Squared" selected></MdSegmentedButton>
<MdSegmentedButton value="b" label="Off"></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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-segmented-button-set aria-label="Themed" style="--md-segmented-button-selected-container-color: var(--md-sys-color-tertiary-container); --md-segmented-button-selected-label-color: var(--md-sys-color-on-tertiary-container); --md-segmented-button-outline-color: var(--md-sys-color-tertiary);">
<md-segmented-button value="a" label="Tertiary" selected></md-segmented-button>
<md-segmented-button value="b" label="Tinted"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Squared" style="--md-segmented-button-container-shape: 6px;">
<md-segmented-button value="a" label="Squared" selected></md-segmented-button>
<md-segmented-button value="b" label="Off"></md-segmented-button>
</md-segmented-button-set><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-segmented-button-set aria-label="Themed" style="--md-segmented-button-selected-container-color: var(--md-sys-color-tertiary-container); --md-segmented-button-selected-label-color: var(--md-sys-color-on-tertiary-container); --md-segmented-button-outline-color: var(--md-sys-color-tertiary);">
<md-segmented-button value="a" label="Tertiary" selected></md-segmented-button>
<md-segmented-button value="b" label="Tinted"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Squared" style="--md-segmented-button-container-shape: 6px;">
<md-segmented-button value="a" label="Squared" selected></md-segmented-button>
<md-segmented-button value="b" label="Off"></md-segmented-button>
</md-segmented-button-set>
</template><script>
import '@awc-ui/core/define';
</script>
<md-segmented-button-set aria-label="Themed" style="--md-segmented-button-selected-container-color: var(--md-sys-color-tertiary-container); --md-segmented-button-selected-label-color: var(--md-sys-color-on-tertiary-container); --md-segmented-button-outline-color: var(--md-sys-color-tertiary);">
<md-segmented-button value="a" label="Tertiary" selected></md-segmented-button>
<md-segmented-button value="b" label="Tinted"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set aria-label="Squared" style="--md-segmented-button-container-shape: 6px;">
<md-segmented-button value="a" label="Squared" selected></md-segmented-button>
<md-segmented-button value="b" label="Off"></md-segmented-button>
</md-segmented-button-set>CSS parts reach inside the segment’s shadow root for what custom properties
do not cover. Every part lives on md-segmented-button, never on the set:
<!-- 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>
.caps-seg::part(label) { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-set {
--md-segmented-button-selected-container-color: #1B5E20;
--md-segmented-button-selected-label-color: #FFFFFF;
--md-segmented-button-outline-color: #1B5E20;
--md-segmented-button-container-shape: 8px;
}
</style>
<md-segmented-button-set aria-label="Uppercase labels">
<md-segmented-button class="caps-seg" value="l" label="List" selected></md-segmented-button>
<md-segmented-button class="caps-seg" value="g" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set class="brand-set" aria-label="Brand colours">
<md-segmented-button value="a" icon="check_circle" label="Live" selected></md-segmented-button>
<md-segmented-button value="b" icon="pending" label="Draft"></md-segmented-button>
</md-segmented-button-set>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSegmentedButton, MdSegmentedButtonSet } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.caps-seg::part(label) { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-set {
--md-segmented-button-selected-container-color: #1B5E20;
--md-segmented-button-selected-label-color: #FFFFFF;
--md-segmented-button-outline-color: #1B5E20;
--md-segmented-button-container-shape: 8px;
}
</style>
<MdSegmentedButtonSet aria-label="Uppercase labels">
<MdSegmentedButton className="caps-seg" value="l" label="List" selected></MdSegmentedButton>
<MdSegmentedButton className="caps-seg" value="g" label="Grid"></MdSegmentedButton>
</MdSegmentedButtonSet>
<MdSegmentedButtonSet className="brand-set" aria-label="Brand colours">
<MdSegmentedButton value="a" icon="check_circle" label="Live" selected></MdSegmentedButton>
<MdSegmentedButton value="b" icon="pending" label="Draft"></MdSegmentedButton>
</MdSegmentedButtonSet>
</>
);
}// 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>
.caps-seg::part(label) { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-set {
--md-segmented-button-selected-container-color: #1B5E20;
--md-segmented-button-selected-label-color: #FFFFFF;
--md-segmented-button-outline-color: #1B5E20;
--md-segmented-button-container-shape: 8px;
}
</style>
<md-segmented-button-set aria-label="Uppercase labels">
<md-segmented-button class="caps-seg" value="l" label="List" selected></md-segmented-button>
<md-segmented-button class="caps-seg" value="g" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set class="brand-set" aria-label="Brand colours">
<md-segmented-button value="a" icon="check_circle" label="Live" selected></md-segmented-button>
<md-segmented-button value="b" icon="pending" label="Draft"></md-segmented-button>
</md-segmented-button-set><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<style>
.caps-seg::part(label) { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-set {
--md-segmented-button-selected-container-color: #1B5E20;
--md-segmented-button-selected-label-color: #FFFFFF;
--md-segmented-button-outline-color: #1B5E20;
--md-segmented-button-container-shape: 8px;
}
</style>
<md-segmented-button-set aria-label="Uppercase labels">
<md-segmented-button class="caps-seg" value="l" label="List" selected></md-segmented-button>
<md-segmented-button class="caps-seg" value="g" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set class="brand-set" aria-label="Brand colours">
<md-segmented-button value="a" icon="check_circle" label="Live" selected></md-segmented-button>
<md-segmented-button value="b" icon="pending" label="Draft"></md-segmented-button>
</md-segmented-button-set>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<style>
.caps-seg::part(label) { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.brand-set {
--md-segmented-button-selected-container-color: #1B5E20;
--md-segmented-button-selected-label-color: #FFFFFF;
--md-segmented-button-outline-color: #1B5E20;
--md-segmented-button-container-shape: 8px;
}
</style>
<md-segmented-button-set aria-label="Uppercase labels">
<md-segmented-button class="caps-seg" value="l" label="List" selected></md-segmented-button>
<md-segmented-button class="caps-seg" value="g" label="Grid"></md-segmented-button>
</md-segmented-button-set>
<md-segmented-button-set class="brand-set" aria-label="Brand colours">
<md-segmented-button value="a" icon="check_circle" label="Live" selected></md-segmented-button>
<md-segmented-button value="b" icon="pending" label="Draft"></md-segmented-button>
</md-segmented-button-set>| Part | What it is |
|---|---|
state-layer | The hover / press overlay |
label | The label text |
icon | The leading glyph, while the segment is unselected |
checkmark | The same slot in the layout once the segment is selected |
icon and checkmark are the same element under two names: one span swaps
between your glyph and the check, and its part swaps with it. That is why a
rule on ::part(icon) stops applying the moment the segment is selected — style
both if you want the treatment to survive selection.
md-segmented-button::part(label) { letter-spacing: 0.4px;}
md-segmented-button::part(icon),md-segmented-button::part(checkmark) { font-size: 20px;}md-segmented-buttonEach segment is an md-segmented-button. It has its own props and parts,
documented here rather than on a separate page: outside a set it is only half a
component, and inside one the parent writes four of its props itself.
| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
value | value | string | '' | — |
selected | selected | boolean | false | Yes |
disabled | disabled | boolean | false | Yes |
softDisabled | soft-disabled | boolean | false | Yes |
icon | icon | string | '' | — |
label | label | string | '' | — |
noCheckmark | no-checkmark | boolean | false | — |
ripple | ripple | boolean | true | — |
segmentIndex | segment-index | number | 0 | — |
segmentTotal | segment-total | number | 1 | — |
segmentDensity | segment-density | number | 0 | — |
segmentMultiselect | segment-multiselect | boolean | false | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
(default) | — |
icon | Custom icon (replaces icon prop) |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-segmented-button-container-color | Unselected bg |
--md-segmented-button-selected-container-color | Selected bg |
--md-segmented-button-label-color | Unselected text |
--md-segmented-button-selected-label-color | Selected text |
--md-segmented-button-outline-color | Outline color |
--md-segmented-button-container-shape | Border-radius |
--md-segmented-button-icon-size | Icon dimensions |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
state-layer | Hover/press overlay |
label | Label text |
md-button-group ·
md-tabs ·
md-chip ·
md-radio ·
md-select ·
md-split-button ·
md-ripple
md-segmented-button-setTwo 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-segmented-button-set 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.
md-segmented-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-segmented-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.