|
| 1 | +--- |
| 2 | +title: "Introducing Mat Expressive: Material 3 Expressive for Angular Material" |
| 3 | +description: Mat Expressive layers Material 3 Expressive — spring motion, shape morphing, and bold sizing — on top of Angular Material, without forking or replacing it. |
| 4 | +publishedOn: 23rd July, 2026 |
| 5 | +order: 1 |
| 6 | +author: |
| 7 | + name: Dharmen |
| 8 | + xHandle: shhdharmen |
| 9 | + avatar: https://avatars.githubusercontent.com/u/6831283?v=4&size=64 |
| 10 | +readTime: 5 |
| 11 | +coverImage: /mat-exp-cover.png |
| 12 | +--- |
| 13 | + |
| 14 | +<img |
| 15 | + src="/mat-exp-cover.png" |
| 16 | + alt="Introducing Mat Expressive: Material 3 Expressive for Angular Material" |
| 17 | + class="w-full md:max-w-6xl! mx-auto rounded-lg" /> |
| 18 | + |
| 19 | +## What is Mat Expressive? |
| 20 | + |
| 21 | +Mat Expressive is a library of styles, directives, and a few new components that sit **on top of** Angular Material. It's not a fork and not a replacement — you keep using `MatButton`, `MatFab`, and the rest of Angular Material as-is. Mat Expressive layers M3 Expressive behavior onto them. |
| 22 | + |
| 23 | +Concretely, it gives you three things: |
| 24 | + |
| 25 | +- **Styles** — SCSS mixins that restyle existing Angular Material components using Material's own [component token overrides](https://material.angular.dev/guide/theming#component-tokens) and CSS variables, so they match M3 Expressive. |
| 26 | +- **Directives** — for the cases styling alone can't reach (things like shape morphing on press, which need actual behavior, not just CSS). |
| 27 | +- **New components** — for patterns M3 Expressive defines that Angular Material doesn't have a component for at all (loading indicators, FAB menus, split buttons). |
| 28 | + |
| 29 | +Under the hood, motion is powered by GSAP spring physics, every animation respects `prefers-reduced-motion`, and the library is SSR-safe. |
| 30 | + |
| 31 | +## Installation |
| 32 | + |
| 33 | +```bash |
| 34 | +ng add @ngm-dev/mat-exp |
| 35 | +``` |
| 36 | + |
| 37 | +The schematic wires up the package for you. From there, add the styles you need globally: |
| 38 | + |
| 39 | +```scss |
| 40 | +// styles.scss |
| 41 | +@use '@ngm-dev/mat-exp' as mat-exp; |
| 42 | + |
| 43 | +html { |
| 44 | + @include mat-exp.mat-exp-button-styles(); |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## A first component: the expressive button |
| 49 | + |
| 50 | +The clearest way to see what Mat Expressive does is the button. Angular Material already has `matButton` — Mat Expressive adds size, shape, and toggle variations on top of it, plus the shape-morph-on-press behavior from the M3 Expressive spec. |
| 51 | + |
| 52 | +You can opt in two ways. |
| 53 | + |
| 54 | +**Option 1 — CSS class + data attributes**, no extra imports beyond styles: |
| 55 | + |
| 56 | +```html |
| 57 | +<button matButton="elevated" class="mat-exp-button" data-size="xs" data-shape="square"> |
| 58 | + Elevated |
| 59 | +</button> |
| 60 | +<button matButton="tonal" class="mat-exp-button" data-size="s">Tonal</button> |
| 61 | +``` |
| 62 | + |
| 63 | +**Option 2 — the `matExpButton` directive**, if you want type safety and two-way bindable inputs: |
| 64 | + |
| 65 | +```ts |
| 66 | +import { MatButton } from '@angular/material/button'; |
| 67 | +import { MatExpButton } from '@ngm-dev/mat-exp'; |
| 68 | + |
| 69 | +@Component({ |
| 70 | + selector: 'app-root', |
| 71 | + imports: [MatButton, MatExpButton], |
| 72 | + template: ` |
| 73 | + <button matButton="elevated" size="xs" shape="square" matExpButton>Elevated</button> |
| 74 | + <button matButton="tonal" size="s" matExpButton>Tonal</button> |
| 75 | + `, |
| 76 | +}) |
| 77 | +export class App {} |
| 78 | +``` |
| 79 | + |
| 80 | +Both approaches give you the same variations: |
| 81 | + |
| 82 | +- **Size**: `xs`, `s`, `m`, `l`, `xl` |
| 83 | +- **Shape**: `round`, `square` |
| 84 | +- **Toggle**: `selected`, `unselected` |
| 85 | +- **State**: `pressed` (driven by the `:active` pseudo-selector) |
| 86 | + |
| 87 | +## Shape morphing, and why it's a directive and not just CSS |
| 88 | + |
| 89 | +One of the defining traits of M3 Expressive buttons is that they morph shape when pressed — round buttons square off slightly, and both round and square buttons converge on the same pressed shape. Toggle buttons go further: the *resting* shape itself changes between selected and unselected states. |
| 90 | + |
| 91 | +This is exactly the kind of thing that can't be pure CSS — it needs to read component state and react to it — which is why `matExpButton` exists as a directive rather than just a stylesheet. |
| 92 | + |
| 93 | +Accessibility is handled automatically here too: the shape-morph transition stops entirely under `prefers-reduced-motion: reduce`, because `matExpButton` piggybacks on Angular Material's own `matButton` host, which already detects the setting. |
| 94 | + |
| 95 | +## Toggle state: a deliberate design choice |
| 96 | + |
| 97 | +If you've used a toggle button before, you might expect `toggle` to flip on click automatically. In Mat Expressive, it doesn't — unless the button lives inside a `<mat-exp-button-group>`. |
| 98 | + |
| 99 | +For a standalone toggle button, the library leaves the click-to-state transition up to you: |
| 100 | + |
| 101 | +```ts |
| 102 | +import { signal } from '@angular/core'; |
| 103 | +import { MatButton } from '@angular/material/button'; |
| 104 | +import { MatExpButton } from '@ngm-dev/mat-exp'; |
| 105 | + |
| 106 | +@Component({ |
| 107 | + selector: 'app-root', |
| 108 | + imports: [MatButton, MatExpButton], |
| 109 | + template: ` |
| 110 | + <button |
| 111 | + matButton="tonal" |
| 112 | + matExpButton |
| 113 | + [(toggle)]="favorited" |
| 114 | + (click)="favorited.set(favorited() === 'selected' ? 'unselected' : 'selected')" |
| 115 | + > |
| 116 | + Favorite |
| 117 | + </button> |
| 118 | + `, |
| 119 | +}) |
| 120 | +export class App { |
| 121 | + protected readonly favorited = model<'selected' | 'unselected'>('unselected'); |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +This is intentional rather than an oversight: a lone button only has one consumer for its click event, so guessing what that click should mean would be presumptuous. Inside a `MatExpButtonGroup`, the group already owns selection state for its buttons — adding your own click handler there would fight it. |
| 126 | + |
| 127 | +## Cutting the CSS payload |
| 128 | + |
| 129 | +By default, the style mixins emit CSS for every size × shape × state × toggle combination. If your app only ever uses two or three sizes, you don't need to ship the rest: |
| 130 | + |
| 131 | +```scss |
| 132 | +@use '@ngm-dev/mat-exp' as mat-exp; |
| 133 | + |
| 134 | +html { |
| 135 | + @include mat-exp.mat-exp-button-styles( |
| 136 | + ( |
| 137 | + sizes: ('s', 'm'), |
| 138 | + ) |
| 139 | + ); |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +There's also a `skip-html-element-styles` option if you don't want Mat Expressive touching the underlying Angular Material DOM elements at all — useful if you're worried about coupling to Angular Material's internal classes, at the cost of losing icon-size adjustments and shape morphing. |
| 144 | + |
| 145 | +## What's included so far |
| 146 | + |
| 147 | +At launch, Mat Expressive covers: |
| 148 | + |
| 149 | +- **Buttons** — [Button](docs/components/all-buttons/button), [Icon Button](docs/components/all-buttons/icon-button), [Button Group](docs/components/all-buttons/button-group), [Split Button](docs/components/all-buttons/split-button), [FAB Menu](docs/components/all-buttons/fab-menu) |
| 150 | +- **Loading & Progress** — an M3 Expressive [loading indicator](/docs/components/loading-and-progress/loading-indicator) with GSAP spring motion |
| 151 | + |
| 152 | +More components are planned, following the same pattern: style what Angular Material already has, build what it doesn't. |
| 153 | + |
| 154 | +## Try it |
| 155 | + |
| 156 | +```bash |
| 157 | +ng add @ngm-dev/mat-exp |
| 158 | +``` |
| 159 | + |
| 160 | +- 📖 Docs: [expressive.angular-material.dev](https://expressive.angular-material.dev/) |
| 161 | +- 💻 GitHub: [github.com/Angular-Material-Dev/mat-exp](https://github.com/Angular-Material-Dev/mat-exp) |
| 162 | +- 🐦 Follow along: [@ngMaterialDev](https://x.com/ngMaterialDev) |
| 163 | + |
| 164 | +It's MIT licensed and free. If you're building on Angular Material and want the M3 Expressive look — motion, shape morphing, and all — without hand-rolling it yourself, give it a try. Issues and feature requests are welcome on GitHub. |
0 commit comments