This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 58).
Material Colors
Read the Material 3 color palette (including Material 3 Dynamic Colors) from JavaScript.
Expo UI Jetpack Compose exposes the Material 3 color palette used by Jetpack Compose so you can pick a palette source and have every component under a <Host> theme from it consistently.
The palette source depends on the options you pass:
- Wallpaper-derived: Default on Android 12+ when no
seedColoris given. Uses Material 3 Dynamic Colors (Material You). - Static Material 3 baseline: Default fallback on Android 11 and below when no
seedColoris given. - Seeded from a color: When you pass a
seedColor, the full palette is derived using the same algorithm that Material 3 Dynamic Colors use for wallpaper-based colors. Works on every Android API level and is independent of the wallpaper.
Installation
If you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Theming <Host> from a seed color
Host accepts seedColor and colorScheme props directly. This is the recommended way to theme a Compose subtree. Native Compose components under this Host render with the seeded palette and any descendant that calls useMaterialColors() without arguments receives the same palette from the Host's context.
Overriding palette roles
Use the colorOverrides prop on Host to set specific Material 3 roles. Host builds the palette from seedColor and colorScheme first. Then it replaces each role that you pass. The other roles keep their palette values. Compose components under the Host and useMaterialColors() both use the result.
import { Button, Host, Text } from '@expo/ui/jetpack-compose'; const colorOverrides = { primary: '#1E88E5FF' } as const; export default function ColorOverridesExample() { return ( <Host seedColor="#8E24AA" colorOverrides={colorOverrides} matchContents> <Button onClick={() => {}}> <Text>Blue primary, purple palette</Text> </Button> </Host> ); }
Reading the current palette inside Host
Call useMaterialColors() without arguments inside a <Host> to read the Host's current palette. The hook returns a reference-stable MaterialColors object and does not cross the native bridge on re-renders.
Computing a specific palette with arguments
Pass arguments to useMaterialColors() to compute a palette on demand, even outside a <Host>. The colorScheme takes 'light' or 'dark', you can omit it to follow the system.
Reading colors outside React components
API
Constants
Type: boolean
Whether the current device supports Material You dynamic colors (Android
12+). When false, getMaterialColors and useMaterialColors
return the static Material 3 baseline palette unless a seedColor is
provided — seed-based palettes work on every Android API level.
Hooks
Returns the Material 3 color palette.
Call with no arguments inside a <Host> to get the palette that <Host> is themed with.
Pass scheme and/or seedColor to get a specific palette.
MaterialColorsMethods
Types
Material 3 color palette exposed to TypeScript/JavaScript as #RRGGBBAA strings.
On Android 12+ devices these values are derived from the app user's wallpaper
(Material You). On older devices they fall back to the static Material 3
baseline palette. Use isDynamicColorAvailable to distinguish the
two at runtime.
8-digit RGBA hex color string, always in #RRGGBBAA form (uppercase).
Compatible with React Native's ColorValue.
String union of string values.