From 429be9b64f627153baf43699cfaa77a27f5252ac Mon Sep 17 00:00:00 2001 From: Andreas Reinhold Date: Mon, 14 Sep 2026 06:01:55 +0200 Subject: [PATCH] Fill the FAB and icon-button glyphs, and cut small ones at 20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M3 asks a FAB's icon and a default (non-toggle) icon button's icon to be filled, never outlined; the toggle half of that rule was already right, so only the `$selected === null` case changed. Every glyph these components draw at 20px now passes `optical="20"` for the cut M3 draws at that size — button xs/sm, group, menu item, the alert, snackbar and FAB-menu close buttons, the stat's icon. Plan step 18, actions.md ACT-14, ACT-15. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9 --- .../livewire-material-development/SKILL.md | 4 ++-- resources/views/components/alert.blade.php | 2 +- resources/views/components/button.blade.php | 17 ++++++++++++----- resources/views/components/fab-menu.blade.php | 4 ++-- resources/views/components/fab.blade.php | 5 ++++- resources/views/components/group.blade.php | 4 +++- resources/views/components/menu-item.blade.php | 4 ++-- resources/views/components/stat.blade.php | 2 +- resources/views/components/toast.blade.php | 2 +- tests/Feature/Components/ButtonTest.php | 17 +++++++++++++++++ tests/Feature/Components/FabTest.php | 8 ++++++++ 11 files changed, 53 insertions(+), 16 deletions(-) diff --git a/resources/boost/skills/livewire-material-development/SKILL.md b/resources/boost/skills/livewire-material-development/SKILL.md index 696f0a57..dd6149df 100644 --- a/resources/boost/skills/livewire-material-development/SKILL.md +++ b/resources/boost/skills/livewire-material-development/SKILL.md @@ -224,7 +224,7 @@ Label button, icon button, toggle and responsive FAB in one component. | `primary`, `danger`, `caution` | | shorthands: filled primary, filled error, filled warning | | `size` | `sm` | `xs` 32px, `sm` 40px, `md` 56px, `lg` 96px, `xl` 136px | | `shape` | `round` | or `square`; both square off further while pressed | -| `icon`, `icon-right` | | Material Symbol names | +| `icon`, `icon-right` | | Material Symbol names; drawn from M3's 20px cut where the glyph is 20px, and filled on a default icon button | | `width` | `default` | icon buttons only: `narrow`, `default`, `wide` | | `selected` | `null` | `true`/`false` makes it a toggle (`aria-pressed`, selected colours and shape) | | `link`, `external`, `no-wire-navigate` | | renders ``, with `wire:navigate` unless external | @@ -291,7 +291,7 @@ Attributes go to the leading button; the slot is the menu. `variant` (`filled` d ### `` -`` — `size` `sm` 56px (default), `md` 80px, `lg` 96px; with `label` it is an extended FAB. `color` `primary`/`secondary`/`tertiary`, drawn in the container, or `variant="filled"`. It does not position itself; wrap it (`
` — M3's 16dp margin, 24dp from `large`). `link`, `external`, `disabled`, `type`. +`` — `size` `sm` 56px (default), `md` 80px, `lg` 96px; with `label` it is an extended FAB. The glyph is filled, as M3 requires of a FAB. `color` `primary`/`secondary`/`tertiary`, drawn in the container, or `variant="filled"`. It does not position itself; wrap it (`
` — M3's 16dp margin, 24dp from `large`). `link`, `external`, `disabled`, `type`. ### ``, `` diff --git a/resources/views/components/alert.blade.php b/resources/views/components/alert.blade.php index dc177cb0..a0ae2803 100644 --- a/resources/views/components/alert.blade.php +++ b/resources/views/components/alert.blade.php @@ -59,7 +59,7 @@ @if ($dismissible) @endif
diff --git a/resources/views/components/button.blade.php b/resources/views/components/button.blade.php index 71ac4209..72f17bd0 100644 --- a/resources/views/components/button.blade.php +++ b/resources/views/components/button.blade.php @@ -15,9 +15,12 @@ With an `icon` and no label it is an icon button: `width` is `narrow`, `default` or `wide`, `variant="text"` is M3's standard icon button, and the tooltip or label names it for screen - readers. `selected` makes it a toggle: `true` or `false` sets `aria-pressed` (not on a `link`, - which is no toggle — give it `aria-current` instead) and M3's selected colours, and a selected round button turns square (a selected square icon button - turns round). Text buttons are not toggles in M3; a selected one takes the tonal container. + readers. Its glyph is filled, as M3 asks of a default icon button. `selected` makes it a + toggle: `true` or `false` sets `aria-pressed` (not on a `link`, which is no toggle — give it + `aria-current` instead) and M3's selected colours, and a selected round button turns square + (a selected square icon button turns round); a toggle reads unselected outlined and selected + filled, which is the rest of the same rule. Text buttons are not toggles in M3; a selected + one takes the tonal container. Values from androidx Compose Material 3's tokens (Button*Tokens, *IconButtonTokens, Apache-2.0); the text button's label is primary, as Compose draws it, not the token's @@ -161,6 +164,10 @@ ? ['xs' => 'size-5', 'sm' => 'size-6', 'md' => 'size-6', 'lg' => 'size-8', 'xl' => 'size-10'][$size] : ['xs' => 'size-5', 'sm' => 'size-5', 'md' => 'size-6', 'lg' => 'size-8', 'xl' => 'size-10'][$size]; + // M3 draws a Material Symbol from a 20px cut below 24px: heavier strokes, wider counters, so a + // small glyph does not thin out. The cut follows the size the icon is drawn at, never the button's. + $optical = $iconSize === 'size-5' ? '20' : '24'; + $outline = ['xs' => 'border', 'sm' => 'border', 'md' => 'border', 'lg' => 'border-2', 'xl' => 'border-3'][$size]; $contained = in_array($variant, ['filled', 'tonal', 'elevated'], true) || ($variant === 'outlined' && $selected === true); @@ -216,7 +223,7 @@ @if ($icon) - + @endif @@ -225,7 +232,7 @@ @endunless @if ($iconRight) - + @endif @if ($tip !== null) diff --git a/resources/views/components/fab-menu.blade.php b/resources/views/components/fab-menu.blade.php index f1b86359..e0116c5f 100644 --- a/resources/views/components/fab-menu.blade.php +++ b/resources/views/components/fab-menu.blade.php @@ -51,8 +51,8 @@ $colours, ]) > - -