Theme Object Structure
TheTheme type defines the complete structure of a Theme UI theme:
Design Scales
Design scales are collections of related values stored as arrays or objects. Theme UI uses these scales to provide consistent styling across your application.Space Scale
The space scale is used for margin, padding, and other spatial properties:Color Scale
Colors can be defined as flat or nested objects:Font Scales
Other Scales
Nested Scales with __default
Theme UI supports nested scales with a special __default key for shorthand access:
Scale Mappings
Theme UI automatically maps CSS properties to theme scales:Example Theme
Here’s a complete example theme from the Theme UI codebase:Using the Theme
Wrap your application withThemeProvider:
Merging Themes
You can merge multiple theme objects:Theme values are automatically applied when using the
sx prop, making it easy to create consistent, theme-aware components.