Material Design for Web
A standards-focused, zero-dependency implemention of Material Design 3 (Material You).
https://clshortfuse.github.io/materialdesignweb/
<script type="module"
src="https://cdn.jsdelivr.net/npm/@shortfuse/materialdesignweb?color=6750A4"></script>
<mdw-button>Hello World!</mdw-button>
Includes all components and theming over URL params.
npx -p @shortfuse/materialdesignweb mdw-css --color=color=6750A4 --custom=yellow,orange:orange,green:0f0,alias:aqua --lightness=auto > theme.css
See loader.js for an example.
import { Button } from '@shortfuse/materialdesignweb';
// OR
import Button from '@shortfuse/materialdesignweb/components/Button.js';
// OR
import Button from 'https://www.unpkg.com/@shortfuse/materialdesignweb/components/Button.js';
// OR
import { Button } from 'https://cdn.jsdelivr.net/npm/@shortfuse/materialdesignweb?color=6750A4';
const button = new Button();
button.textContent = 'Hello World!';
document.body.append(button);
Compatibility is kept for as long possible by including browser-version-based patches. Ultimately, compatiblity may be dropped as new features get added. Bugs present in supported browsers should always be fixed.
Feature | Chrome | Edge | Firefox | Safari |
---|---|---|---|---|
ShadowRoot | 53 | 79 | 63 | 10 |
WeakRef | 84 | 84 | 79 | 14.1 |
:where() | 88 | 88 | 78 | 14 |
Array.atβ | 92 | 92 | 90 | 15.4 |
replaceChildrenβ | 84 | 86 | 79 | 14.1 |
ElementInternalsβ | 77 | 79 | 93 | 16.4 |
delegatesFocusβ | 53 | 79 | 94 | 15 |
AdoptedStyleSheets* | 73 | 79 | 101 | 16.4 |
CSS container queries* | 106 | 106 | 110 | 16.0 |
Compatibility | 88 | 88 | 78 | 16.4 |
Support | Latest ChromeOS LTS Release | Microsoft Edge Extended Stable Channel | ESR 115 | Last 2 Versions |
Status |
*Optional
β Can be polyfilled
Notes:
- Compatibility may be extended via polyfills (not included)
Component | Description | Status | Size |
---|---|---|---|
Box | Simple themeable component with Flex and Grid options | βοΈ | |
Layout | Manages page nav, and pane layouts | π§ | |
Icon | Font-icon, SVG, and IMG support | π§ | |
Body | Box with Body typography | βοΈ | |
Label | Box with Label typography | βοΈ | |
Headline | Box with Headline typography | βοΈ | |
Title | Box with Title typography | βοΈ | |
Ripple | Ripple effect | βοΈ | |
Shape | Themeable, flexable, shapeable element | βοΈ | |
Surface | Themeable, flexable, shapeable, elevateable element | βοΈ |
Mixin | Description | Status | Size |
---|---|---|---|
AriaReflector | Reflects ARIA Properties | βοΈ | |
AriaToolbar | Shared ARIA Toolbar functionality | βοΈ | |
Control | HTML Control wrapper | βοΈ | |
Density | Component density options | βοΈ | |
Flexable | Add flexbox options as attributes | βοΈ | |
FormAssociated | Form-associated custom element support | βοΈ | |
Input | HTMLInputElement wrapper | βοΈ | |
KeyboardNav | Adds arrow key navigation and roving tab index | ||
ResizeObserver | Shared Eelement resize observer | βοΈ | |
Ripple | Replaces pressed state with ripple effect | βοΈ | |
RTLObserver | Shared RTL paoge observer | βοΈ | |
ScrollListener | Listen for horizontal and vertical scroll events | βοΈ | |
Shape | Adds shape and outline layer to elements | ||
Surface | Adds shadows to elements | ||
TextField | Shared text field functionality | βοΈ | |
TooltipTrigger | Triggers tooltips based on events | π§ | |
TouchTarget | Adds extended touch target to controls | π§ |
File | Description | Status | Size |
---|---|---|---|
Composition | Composes templates based on styles, fragments, and watches. Renders data | π§ | |
CustomElement | Handles ShadowDOM, ElementInternals, Property attributes, and compositions | π§ | |
CompositionAdapter | Handles data array to elements binding | π§ | |
jsonMergePatch | Applies, constructors, and evaluates JSON Merge Patch | π§ | |
css | CSS, CSSStyleSheet, HTMLStyleElement functions | βοΈ | |
customTypes | Non-primitive observable types | π§ | |
optimizations | Micro-optimizations functions | π§ | |
dom | DOM functions | ||
observe | Observable pattern for primitives and objects | π§ | |
template | Template literals for CSS (CSSStyleSheet) and HTML (DocumentFragment) | βοΈ | |
uid | Generates a UID string | βοΈ |
These components do not have official M3 guidelines
Component | Status |
---|---|
π | |
Banner | π§ |
Data Table | π |
Image List | β |
-
ποΈ - Background Theming
-
ποΈ - Ink (Foreground) Theming
-
β - Outline
-
π °οΈ - Font Theming -
π· - Shape Size Theming
-
πΆ - Density
-
βοΈ - Flexable layout -
βΏ - ARIA Role
-
βοΈ - Ready
-
β οΈ - Issues -
π§ - Under Construction
-
π - Planned
-
β - Unknown
-
π - Not planned
The Material Design 1/2 version has been archived in the archive-md2
branch.