Browse components

Theming

mui-lite themes are plain objects. Colors become CSS variables on the ThemeProvider wrapper.

Default theme

import { DefaultTheme, type MuiTheme } from "@shpaw415/mui-lite/theme";
 
const theme: MuiTheme = {
  ...DefaultTheme,
  theme: "dark", // "light" | "dark"
  locale: "enUS",
};

Color tokens

Each token has light, dark, and main shades:

Background: bg-primary, bg-secondary, bg-error, bg-success, bg-warning, bg-main, bg-surface
Text: text-primary, text-secondary, text-error, text-success, text-warning, text-info, text-main

In CSS:

.my-box {
  background: rgb(var(--bg-surface));
  color: rgb(var(--text-main));
}

Hooks

import { useTheme, useSystemTheme, SystemTheme } from "@shpaw415/mui-lite/theme";
 
const theme = useTheme();
const [system, setSystem] = useSystemTheme();
const once = SystemTheme(); // "light" | "dark"

Breakpoints

KeyMin width
xs0
sm600
md900
lg1200
xl1536

Used by the sx prop and useMediaQuery from utils/theme.

z-index

LayerValue
mobileStepper1000
fab / speedDial1050
appBar1100
drawer1200
modal1300
snackbar1400
tooltip1500