Skip to main content brightness_auto motion_photos_off palette download more_vert
toc

Support

Version 3.0 targets Baseline widely available: the web platform features it uses have worked in all major browsers for at least 30 months.

Version 3.0 targets Baseline widely available: the web platform features it uses have worked in all major browsers for at least 30 months. Newer features (such as corner-shape or light-dark()) are only used behind @supports guards or with a fallback, so components stay usable in older engines. The repository checks this with npm run gb:baseline. See Browser support for the minimum versions.

How do I change the color of a button?

Link to “How do I change the color of a button?”

Components read --md-sys-color-* tokens. Override the key color a component uses on the element or a class. Buttons use primary, and the states (hover, focus, pressed) are derived from it.

Delete
HTMLCSS
<md-gb-button class="danger" color="filled">Delete</md-gb-button>

Why doesn't prefers-color-scheme: dark switch the theme?

Link to “Why doesn't prefers-color-scheme: dark switch the theme?”

The tokens use light-dark(), so they follow the color-scheme property. Set it to follow the system, or force a scheme on any subtree.

Save Cancel
HTMLCSS
<div class="always-dark">
  <md-gb-button color="filled">Save</md-gb-button>
  <md-gb-button color="outlined">Cancel</md-gb-button>
</div>

How do I generate my own --md-sys-color-* tokens?

Link to “How do I generate my own --md-sys-color-* tokens?”

Generate a theme from a source color at runtime, or export a stylesheet.

HTMLJS
<md-gb-button color="filled">Save</md-gb-button>

You can also design a scheme with the Material Theme Builder Figma plugin. See Color.

How do I style an element inside another component?

Link to “How do I style an element inside another component?”

Use CSS ::part(). The parts of each component are listed under its CSS parts in the API reference.

Install Material Web 3.0

Your browser did not offer to install the docs as an app. Install them from the browser instead:

Close
Send feedback
Bug Documentation Idea

Opens a new GitHub issue for material-components/material-web in a new tab, with this filled in.

Cancel Open issue