skills/material-design-3-layout/SKILL.md
Applies Material Design 3 Expressive layout, spacing, and size hierarchy principles including grid systems, responsive design, and elevation. Use this when working on page layouts, spacing, grids, responsive design, or when the user asks to apply Material Design 3 layout guidelines.
npx skillsauth add shelbeely/shelbeely-agent-skills material-design-3-layoutInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill guides the implementation of Material Design 3 (M3) Expressive layout and spacing principles to create clear, organized, and responsive interfaces.
Keywords: Material Design 3, M3, layout, spacing, grid, responsive design, breakpoints, size hierarchy, elevation, padding, margin
M3 layout — from Material You foundations to M3 Expressive — focuses on:
M3 uses a consistent 4dp spacing scale for all layout spacing:
:root {
/* Spacing scale */
--md-sys-spacing-0: 0px;
--md-sys-spacing-1: 4px;
--md-sys-spacing-2: 8px;
--md-sys-spacing-3: 12px;
--md-sys-spacing-4: 16px;
--md-sys-spacing-5: 20px;
--md-sys-spacing-6: 24px;
--md-sys-spacing-7: 28px;
--md-sys-spacing-8: 32px;
--md-sys-spacing-9: 36px;
--md-sys-spacing-10: 40px;
--md-sys-spacing-12: 48px;
--md-sys-spacing-14: 56px;
--md-sys-spacing-16: 64px;
--md-sys-spacing-20: 80px;
--md-sys-spacing-24: 96px;
}
Define semantic spacing for common patterns:
:root {
/* Component spacing */
--md-sys-spacing-component-gap: var(--md-sys-spacing-2); /* 8px */
--md-sys-spacing-component-padding: var(--md-sys-spacing-4); /* 16px */
/* Layout spacing */
--md-sys-spacing-section-gap: var(--md-sys-spacing-6); /* 24px */
--md-sys-spacing-page-margin: var(--md-sys-spacing-4); /* 16px */
/* List spacing */
--md-sys-spacing-list-item-gap: var(--md-sys-spacing-2); /* 8px */
--md-sys-spacing-list-padding: var(--md-sys-spacing-4); /* 16px */
}
M3 defines standard breakpoints for responsive design:
:root {
/* Breakpoints */
--md-sys-breakpoint-xs: 0px; /* Extra small (phones) */
--md-sys-breakpoint-sm: 600px; /* Small (tablets portrait) */
--md-sys-breakpoint-md: 905px; /* Medium (tablets landscape) */
--md-sys-breakpoint-lg: 1240px; /* Large (laptops) */
--md-sys-breakpoint-xl: 1440px; /* Extra large (desktops) */
}
Mobile (0-599px):
Tablet (600-904px):
Desktop (905px+):
.layout-grid {
display: grid;
gap: var(--md-sys-spacing-4);
padding: var(--md-sys-spacing-4);
/* Mobile: 4 columns */
grid-template-columns: repeat(4, 1fr);
}
@media (min-width: 600px) {
.layout-grid {
gap: var(--md-sys-spacing-6);
padding: var(--md-sys-spacing-6);
/* Tablet: 8 columns */
grid-template-columns: repeat(8, 1fr);
}
}
@media (min-width: 905px) {
.layout-grid {
/* Desktop: 12 columns */
grid-template-columns: repeat(12, 1fr);
}
}
Padding:
.button {
padding: var(--md-sys-spacing-2) var(--md-sys-spacing-6);
min-height: 40px;
gap: var(--md-sys-spacing-2);
}
Padding:
Spacing between elements:
.card {
padding: var(--md-sys-spacing-4);
display: flex;
flex-direction: column;
gap: var(--md-sys-spacing-2);
}
.card-actions {
margin-top: var(--md-sys-spacing-4);
display: flex;
gap: var(--md-sys-spacing-2);
}
Padding:
Sizing:
.dialog {
padding: var(--md-sys-spacing-6);
min-width: 280px;
max-width: 560px;
display: flex;
flex-direction: column;
gap: var(--md-sys-spacing-4);
}
@media (max-width: 599px) {
.dialog {
width: calc(100% - 32px);
margin: var(--md-sys-spacing-4);
}
}
Spacing:
.list-item {
padding: var(--md-sys-spacing-2) var(--md-sys-spacing-4);
display: flex;
align-items: center;
gap: var(--md-sys-spacing-4);
min-height: 56px;
}
App Bar:
Navigation Rail:
Bottom Navigation:
.app-bar {
height: 56px;
padding: 0 var(--md-sys-spacing-4);
display: flex;
align-items: center;
gap: var(--md-sys-spacing-6);
}
@media (min-width: 600px) {
.app-bar {
height: 64px;
}
}
M3 Expressive uses size strategically to create visual hierarchy:
Hero Elements (Largest):
Primary Elements (Large):
Standard Elements (Base):
Secondary Elements (Small):
Tertiary Elements (Smallest):
/* Hero button */
.button-hero {
padding: var(--md-sys-spacing-4) var(--md-sys-spacing-10);
min-height: 56px;
font-size: 18px;
}
/* Standard button */
.button-standard {
padding: var(--md-sys-spacing-2) var(--md-sys-spacing-6);
min-height: 40px;
font-size: 14px;
}
/* Small button */
.button-small {
padding: var(--md-sys-spacing-1) var(--md-sys-spacing-4);
min-height: 32px;
font-size: 12px;
}
M3 uses elevation to show depth and hierarchy:
Level 0 (On surface):
Level 1 (Slight elevation):
0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.15)Level 2 (Elevated):
0 2px 4px rgba(0,0,0,0.3), 0 3px 4px rgba(0,0,0,0.15)Level 3 (Floating):
0 4px 8px rgba(0,0,0,0.3), 0 6px 8px rgba(0,0,0,0.15)Level 4 (Modal):
0 8px 12px rgba(0,0,0,0.3), 0 12px 16px rgba(0,0,0,0.15)Level 5 (High modal):
0 12px 16px rgba(0,0,0,0.3), 0 16px 24px rgba(0,0,0,0.15):root {
--md-sys-elevation-0: none;
--md-sys-elevation-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.15);
--md-sys-elevation-2: 0 2px 4px rgba(0,0,0,0.3), 0 3px 4px rgba(0,0,0,0.15);
--md-sys-elevation-3: 0 4px 8px rgba(0,0,0,0.3), 0 6px 8px rgba(0,0,0,0.15);
--md-sys-elevation-4: 0 8px 12px rgba(0,0,0,0.3), 0 12px 16px rgba(0,0,0,0.15);
--md-sys-elevation-5: 0 12px 16px rgba(0,0,0,0.3), 0 16px 24px rgba(0,0,0,0.15);
}
M3 adds a subtle color tint to elevated surfaces:
.elevated-surface {
background-color: var(--md-sys-color-surface);
box-shadow: var(--md-sys-elevation-1);
/* Add subtle tint using primary color */
background-image: linear-gradient(
rgba(var(--md-sys-color-primary-rgb), 0.05),
rgba(var(--md-sys-color-primary-rgb), 0.05)
);
}
Start with mobile layout, then enhance for larger screens:
/* Mobile: Stack vertically */
.content-layout {
display: flex;
flex-direction: column;
gap: var(--md-sys-spacing-4);
padding: var(--md-sys-spacing-4);
}
/* Tablet: Two columns */
@media (min-width: 600px) {
.content-layout {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--md-sys-spacing-6);
padding: var(--md-sys-spacing-6);
}
}
/* Desktop: Three columns with sidebar */
@media (min-width: 905px) {
.content-layout {
grid-template-columns: 250px 1fr 1fr;
}
}
Use for component-level responsiveness:
.card-container {
container-type: inline-size;
}
.card {
display: flex;
flex-direction: column;
}
@container (min-width: 400px) {
.card {
flex-direction: row;
gap: var(--md-sys-spacing-4);
}
}
Centered Content:
.centered-layout {
max-width: 1200px;
margin: 0 auto;
padding: var(--md-sys-spacing-6);
}
Sidebar Layout:
.sidebar-layout {
display: grid;
grid-template-columns: 250px 1fr;
gap: var(--md-sys-spacing-6);
}
@media (max-width: 904px) {
.sidebar-layout {
grid-template-columns: 1fr;
}
}
Dashboard Grid:
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: var(--md-sys-spacing-4);
}
Use visible boundaries to group related content:
/* Card containment with outline */
.contained-group {
border: 1px solid var(--md-sys-color-outline-variant);
border-radius: var(--md-sys-shape-corner-medium);
padding: var(--md-sys-spacing-4);
background: var(--md-sys-color-surface-container);
}
/* Elevated containment */
.elevated-group {
box-shadow: var(--md-sys-elevation-1);
border-radius: var(--md-sys-shape-corner-medium);
padding: var(--md-sys-spacing-4);
background: var(--md-sys-color-surface-container-low);
}
Use proximity, open space, and alignment to group items without visible borders:
/* Implicit grouping through proximity */
.implicit-group {
display: flex;
flex-direction: column;
gap: var(--md-sys-spacing-1); /* Tight spacing implies grouping */
}
/* Separated groups use larger spacing */
.section-gap {
margin-bottom: var(--md-sys-spacing-8); /* Larger gap separates groups */
}
| Containment Type | Use When | |------------------|----------| | Explicit (borders/cards) | Interactive content, distinct sections, actionable groups | | Explicit (elevation) | Content that needs to feel "lifted" or modal | | Implicit (proximity) | Related text blocks, label-value pairs, sequential content | | Implicit (alignment) | Grid layouts, navigation items, consistent structure |
M3 Expressive introduces background blur and layering for improved depth and focus:
Strategic blur behind overlays, modals, and navigation elements:
/* Blur behind modal dialogs */
.dialog-backdrop {
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
background-color: rgba(0, 0, 0, 0.32);
}
/* Blur behind floating toolbars */
.floating-toolbar {
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
background-color: rgba(var(--md-sys-color-surface-rgb), 0.85);
}
/* Blur behind navigation drawers */
.nav-drawer-scrim {
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
background-color: var(--md-sys-color-scrim);
opacity: 0.32;
}
Combine elevation, blur, and surface tinting for clear layering:
/* Layer 1: Base content */
.base-layer {
background: var(--md-sys-color-surface);
}
/* Layer 2: Elevated content */
.elevated-layer {
background: var(--md-sys-color-surface-container);
box-shadow: var(--md-sys-elevation-1);
}
/* Layer 3: Overlay with blur */
.overlay-layer {
backdrop-filter: blur(16px);
background: rgba(var(--md-sys-color-surface-container-high-rgb), 0.9);
box-shadow: var(--md-sys-elevation-3);
}
M3 defines consistent interaction states for all interactive elements:
State layers are overlays using the content color at specific opacities:
| State | Opacity | Description | |-------|---------|-------------| | Enabled | 0% | Default, no overlay | | Hovered | 8% | Pointer device hover | | Focused | 12% | Keyboard/accessibility focus | | Pressed | 12% | Touch/click press | | Dragged | 16% | Active drag operation | | Disabled | 0% | Non-interactive (content at 38%, background at 12%) |
/* State layer implementation */
.interactive-element {
position: relative;
}
.interactive-element::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
background: var(--md-sys-color-on-surface);
opacity: 0;
transition: opacity 200ms var(--md-sys-motion-easing-standard);
pointer-events: none;
}
.interactive-element:hover::before { opacity: 0.08; }
.interactive-element:focus-visible::before { opacity: 0.12; }
.interactive-element:active::before { opacity: 0.12; }
/* Disabled state */
.interactive-element:disabled {
opacity: 0.38;
pointer-events: none;
}
.interactive-element:disabled::before {
opacity: 0;
}
Only one state layer is visually applied at a time. Priority order:
All interactive elements must be at least 48×48dp:
.touch-target {
min-width: 48px;
min-height: 48px;
/* Visual size can be smaller with padding */
padding: var(--md-sys-spacing-3);
}
Ensure adequate spacing for focus rings:
.focusable {
position: relative;
}
.focusable:focus-visible {
outline: 2px solid var(--md-sys-color-primary);
outline-offset: 2px;
}
When implementing M3 layout, ensure:
tools
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
development
Generate Material Design 3 color themes programmatically from a source color using @material/material-color-utilities, the same engine that powers the Material Theme Builder. Use this when the user asks to generate an M3 color palette, create a custom theme from a brand color, or export M3 tokens to CSS, JSON, or framework configs.
testing
Applies Material Design 3 Expressive typography principles including variable fonts, type scales, and hierarchy. Use this when working on text styling, type hierarchy, readable interfaces, or when the user asks to apply Material Design 3 typography guidelines.
testing
Applies Material Design 3 Expressive shape and containment principles including rounded corners, morphing shapes, and container design. Use this when working on component shapes, borders, containment, or when the user asks to apply Material Design 3 shape guidelines.