What is Material 3?
Material 3 (a.k.a. Material You) is the latest version of Google’s Material Design system (released with Android 12+).
It’s all about personalization, dynamic color, and adaptive UI.
In Jetpack Compose, it’s supported by:
import androidx.compose.material3.*
Key New Features (vs. Material 2)
| Area | Material 2 | Material 3 (New) | Why It Matters (Interview Tip) |
|---|---|---|---|
| 🎨 Theming System | Static color palette (light/dark) | Dynamic color system — UI automatically adapts colors from wallpaper (via Material You / Monet engine) | More user personalization & consistency with system theme |
| 🧱 Components | Old components (Button, TextField, etc.) |
New & redesigned ones: FilledTonalButton, OutlinedCard, AssistChip, SuggestionChip, etc. |
More flexible + accessible UI components |
| ⚙️ Typography | Hardcoded Typography styles |
Typography with scalable design tokens and dynamic defaults (displayLarge, headlineMedium etc.) |
Easier responsive design |
| 🧩 Shapes & Elevation | Fixed shapes/elevation | Uses tonal elevation (surface color shifts instead of shadows) | Better dark theme consistency |
| 🌈 Color System |
primary, secondary, etc. |
Extended color roles: primaryContainer, onPrimaryContainer, surfaceVariant, errorContainer, etc. |
Fine-grained theming & contrast control |
| 🧭 Navigation Bar / FABs | Flat styles | New FAB variants, NavigationBar with rounded highlights | Modern look (aligns with Android 13 UI) |
| 🕹 State handling | Manual states | New StateLayer built into components (hover, focus, pressed) | Better touch/hover feedback automatically |
| ⚡ Adaptive Design | Not responsive-friendly | M3 supports adaptive layouts (large screens, foldables, tablets) | Crucial for multi-device apps |
| ♿ Accessibility | Basic | Larger default text sizes, better contrast, color harmonization | Easier accessibility compliance |
1. Dynamic Color (Biggest Feature)
Material 3 allows auto-theming based on wallpaper (Android 12+).
Example in Compose:
@Composable
fun MyApp() {
val dynamicColor = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
val colorScheme = when {
dynamicColor -> dynamicColorScheme(LocalContext.current)
else -> lightColorScheme()
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = { MyScreen() }
)
}
Tip: This is implemented using Monet color extraction engine, generating tonal palettes from wallpaper.
2. New Design Tokens
Material 3 introduces design tokens for all system attributes:
- Color roles (instead of primary/secondary alone)
-
Typography roles (
headlineLarge,bodySmall, etc.) -
Shape tokens (
extraSmall,medium,extraLarge) -
Elevation tokens (
level0tolevel5)
These give consistent scaling across UI components.
Example:
val shapes = Shapes(
small = RoundedCornerShape(8.dp),
medium = RoundedCornerShape(12.dp),
large = RoundedCornerShape(24.dp)
)
3. New Components
🪄 Buttons
FilledButtonFilledTonalButtonOutlinedButtonTextButtonElevatedButton
Example:
FilledTonalButton(onClick = { }) {
Text("Save")
}
🪩 Chips
New types of Chips for input, filters, suggestions:
AssistChip(onClick = { }, label = { Text("Assist") })
SuggestionChip(onClick = { }, label = { Text("Suggestion") })
FilterChip(selected = true, onClick = { }, label = { Text("Filter") })
🧠 Cards
More expressive variants:
ElevatedCard { /* shadowed */ }
OutlinedCard { /* border only */ }
FilledCard { /* background filled */ }
🧭 Navigation Bars
New composables:
NavigationBar { /* bottom nav */ }
NavigationDrawer { /* side drawer */ }
TopAppBar / CenterAlignedTopAppBar
They support scroll behavior and tonal color adaptation.
4. Tonal Elevation (Instead of Shadows)
Material 3 prefers tonal color blending to indicate elevation:
- Higher elevation = lighter/darker surface color
- Better suited for dark theme (no unnatural shadows)
Compose handles this via:
surfaceColorAtElevation(elevation = 3.dp)
5. MaterialTheme Changes
In M2:
MaterialTheme(colors = ...)
In M3:
MaterialTheme(colorScheme = ..., typography = ..., shapes = ...)
And for colors:
val color = MaterialTheme.colorScheme.primaryContainer
6. Updated Typography System
val typography = Typography(
displayLarge = TextStyle(...),
headlineMedium = TextStyle(...),
bodySmall = TextStyle(...)
)
Instead of old h1, h2, subtitle1, etc.
Example Source Code (Jetpack Compose M3)
@Composable
fun Material3Demo() {
MaterialTheme(
colorScheme = dynamicColorScheme(LocalContext.current),
typography = Typography()
) {
Scaffold(
topBar = {
CenterAlignedTopAppBar(title = { Text("Material 3 Demo") })
},
floatingActionButton = {
FloatingActionButton(onClick = { }) {
Icon(Icons.Default.Add, contentDescription = "Add")
}
}
) { padding ->
Column(
modifier = Modifier
.padding(padding)
.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
FilledTonalButton(onClick = {}) { Text("Save") }
AssistChip(onClick = {}, label = { Text("Assist") })
ElevatedCard { Text("Modern Card") }
}
}
}
}
Summary
| Category | What’s New |
|---|---|
| 🎨 Dynamic Color (Material You) | Auto wallpaper-based theming |
| 🧱 New Components | Buttons, Chips, Cards, Navigation Bars |
| 🧩 Tonal Elevation | No shadow, uses color blending |
| ⚙️ Color Roles |
primaryContainer, surfaceVariant, etc. |
| 🧠 New Typography Tokens |
displayLarge, bodyMedium, etc. |
| 🧭 Adaptive Layouts | Responsive for tablets, foldables |
| ♿ Accessibility | Better contrast, dynamic sizing |
Top comments (0)