Skip to content

clshortfuse/materialdesignweb

Repository files navigation

materialdesignweb

Material Design for Web

A standards-focused, zero-dependency implemention of Material Design 3 (Material You).

Version License MinZip Dependents

Demo

https://clshortfuse.github.io/materialdesignweb/

Getting started

Pre-bundled

<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.

Development

Static Theme Generation:

npx -p @shortfuse/materialdesignweb mdw-css --color=color=6750A4 --custom=yellow,orange:orange,green:0f0,alias:aqua --lightness=auto > theme.css

Dynamic Theme Generation:

See loader.js for an example.

Component Loading

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);

Support

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 Chrome Edge Firefox Safari

*Optional

†Can be polyfilled

Notes:

  • Compatibility may be extended via polyfills (not included)

Components

Component Features Status Size
Badge 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Bottom App Bar 🖌️ 🖍️ 🅰️ 🔷 ✔️ Size
Bottom Sheet 📝
Button 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Card 🖌️ 🖍️ 🅰️ 🔷 ↕️ ✔️ Size
Fab 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Fab - Extended 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Icon Button 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Segmented Button 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Segmented Button Group 🖍️ ✔️ Size
Checkbox 🖌️ 🖍️ 🅰️ 🔷 ✔️ Size Size
Chip 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Chip - Filter 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Chip: Filter Dropdown 🚧
Chip: Input 🚧
Date Picker
Dialog 🖌️ 🖍️ 🅰️ 🔷 ✔️ Size
Dialog: Full-screen
Divider 🖍️ ✔️ Size
Icon 🖍️ ✔️ Size
List 🖌️ 🖍️ 📶 ✔️ Size Size
Listbox 🖌️ 🖍️ 📶 ✔️ Size Size
Menu 🖌️ 🖍️ 📶 ✔️ Size Size
Navigation Bar 🖌️ 🖍️ 🔷 ✔️ Size Size
Navigation Drawer 🖌️ 🖍️ 🔷 🚧 Size Size
Navigation Rail 🖌️ 🖍️ 🔷 ✔️ Size Size
Progress Indicators 🖍️ ✔️ Size
Search 🖌️ 🖍️ 🅰️ 🔷 🚧 Size
Radio 🖍️ 🅰️ 🔷 ✔️ Size Size
Side Sheet 🚧
Slider 🖍️ ⚠️ Size
Snackbar 🖌️ 🖍️ 🔷 📶 ✔️ Size
Switch 🖌️ 🖍️ 🅰️ ✔️ Size Size
Tab 🖌️ 🖍️ 🔷 ✔️ Size Size Size Size
Text Input 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Text Area 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Text Select 🖌️ 🖍️ 🅰️ 🔷 📶 ✔️ Size
Time Picker
Tooltip 🖌️ 🖍️ 🔷 ✔️ Size
Top App Bar 🖌️ 🖍️ 🅰️ ✔️ Size

Additional

Component Description Status Size
Box Simple themeable component with Flex and Grid options ✔️ Size
Layout Manages page nav, and pane layouts 🚧 Size
Icon Font-icon, SVG, and IMG support 🚧 Size
Body Box with Body typography ✔️ Size
Label Box with Label typography ✔️ Size
Headline Box with Headline typography ✔️ Size
Title Box with Title typography ✔️ Size
Ripple Ripple effect ✔️ Size
Shape Themeable, flexable, shapeable element ✔️ Size
Surface Themeable, flexable, shapeable, elevateable element ✔️ Size

Mixins

Mixin Description Status Size
AriaReflector Reflects ARIA Properties ✔️ Size
AriaToolbar Shared ARIA Toolbar functionality ✔️ Size
Control HTML Control wrapper ✔️ Size
Density Component density options ✔️ Size
Flexable Add flexbox options as attributes ✔️ Size
FormAssociated Form-associated custom element support ✔️ Size
Input HTMLInputElement wrapper ✔️ Size
KeyboardNav Adds arrow key navigation and roving tab index ⚠️ Size
ResizeObserver Shared Eelement resize observer ✔️ Size
Ripple Replaces pressed state with ripple effect ✔️ Size
RTLObserver Shared RTL paoge observer ✔️ Size
ScrollListener Listen for horizontal and vertical scroll events ✔️ Size
Shape Adds shape and outline layer to elements ⚠️ Size
Surface Adds shadows to elements ⚠️ Size
TextField Shared text field functionality ✔️ Size
TooltipTrigger Triggers tooltips based on events 🚧 Size
TouchTarget Adds extended touch target to controls 🚧 Size

Core

File Description Status Size
Composition Composes templates based on styles, fragments, and watches. Renders data 🚧 Size
CustomElement Handles ShadowDOM, ElementInternals, Property attributes, and compositions 🚧 Size
CompositionAdapter Handles data array to elements binding 🚧 Size
jsonMergePatch Applies, constructors, and evaluates JSON Merge Patch 🚧 Size
css CSS, CSSStyleSheet, HTMLStyleElement functions ✔️ Size
customTypes Non-primitive observable types 🚧 Size
optimizations Micro-optimizations functions 🚧 Size
dom DOM functions ⚠️ Size
observe Observable pattern for primitives and objects 🚧 Size
template Template literals for CSS (CSSStyleSheet) and HTML (DocumentFragment) ✔️ Size
uid Generates a UID string ✔️ Size

Other Components

These components do not have official M3 guidelines

Component Status
Backdrop 💀
Banner 🚧
Data Table 📝
Image List

Legend

Archive

The Material Design 1/2 version has been archived in the archive-md2 branch.