Theming
Keep the Material foundation. Change the parts that make it yours.
A themed distribution
Field Notes is an editable example built from the same components. Switch between the original palette, teal and deep orange, and a dark semantic theme. Dialogs, nested pickers, menus and tooltips carry the selected theme into their portals.
Field Notes
Coastal survey
North coast · October 2026
Record shoreline habitats, compare observations, and plan the next visit.
| Site | Status | Records |
|---|---|---|
| Salt marsh | Reviewed | 8 |
| Sand dunes | In progress | 4 |
Field preferences
Preferred temperature (°C)
The navigation drawer is contained in the example and leaves the documentation usable. In the installed examples/field-notes/index.tsx, <DrawerRoot modal={false}> wraps a positioned container, and <DrawerPortal container={viewport}> renders the drawer inside it with absolute positioning. Portal placement and modality are separate: a custom container does not scope a modal’s focus trap or scroll lock, so the visit dialog and its pickers use the page viewport and keep their modal behavior.
pnpm dlx shadcn@latest add https://react-toolbox.io/r/example-field-notes.jsonimport { FieldNotes } from "@/components/ui/examples/field-notes";
<FieldNotes appearance="field-notes" />The example exports its theme variables. Copy them into your own provider or edit the installed components. The example imports the optional material/foundations/styles/shadcn.css stylesheet. It maps semantic colors without changing Material dimensions or motion.
Start with color
Theme shared colors with CSS variables in your global stylesheet. Tailwind utilities such as bg-toolbox-primary use those same variables. The default palette is Material indigo and pink.
:root {
--rt-color-primary: #00695c;
--rt-color-primary-dark: #004d40;
--rt-color-primary-contrast: #ffffff;
--rt-color-accent: #ff6d00;
--rt-color-accent-contrast: #212121;
}On light surfaces, M1 uses 87% black for primary text, 54% for secondary text, 38% for disabled text, and 12% for dividers. These docs scope the text variables to alpha colors so they blend with their surface. When customizing a palette, check text and icon contrast in every state. See the original color guidance.
Style the components you compose
Pass Tailwind utilities through className on each component. Compose the exported parts to customize individual nodes. For an internal element that is not exposed as a component, edit its classes in the installed source. The JSX and styles belong to your application.
Checkbox, RadioButton and Switch apply both className and style to their root label. Native form attributes and event handlers still target the underlying input.
import { Button } from "@/components/ui/material/button";
import { Card, CardText, CardActions } from "@/components/ui/material/card";
<Card className="max-w-md">
<CardText className="text-toolbox-text-secondary">
Your changes are ready to save.
</CardText>
<CardActions className="justify-end gap-2">
<Button primary className="min-w-24">Save</Button>
</CardActions>
</Card>Conflicting base utilities resolve in favor of your classes. Responsive and state variants keep normal Tailwind precedence; match the variant when overriding it. Use CSS variables for colors across states.
CSS variables control shared colors, and ThemeProvider scopes those variables when needed. For deeper customization, compose the exported parts or edit the installed source.
Scope a palette when you need to
Global CSS variables need no provider. Use ThemeProvider when a section needs its own palette: it carries scoped variables into dialogs, menus, and other portaled content too.
import { ThemeProvider } from "@/components/ui/material/theme";
<ThemeProvider variables={{ "--rt-color-primary": "#00695c" }}>
<YourSection />
</ThemeProvider>Material tokens use the --rt-color- prefix so they can coexist with a shadcn theme. Map them explicitly to your app’s semantic tokens if you want both libraries to share colors.
A Material rhythm
React Toolbox preserves your app’s Tailwind spacing scale. Components keep their Material dimensions; utilities such as p-6 and gap-2 follow your theme.
To use the Material 4px subgrid throughout your app, add this optional setting to your global stylesheet after its imports. This site uses it for the spacing shown below.
@theme {
--spacing: 4px;
}Prefer multiples of 8px for layout spacing; the 4px subgrid accommodates typography and icons.
| Utility | Spacing |
|---|---|
gap-2 | 8px |
p-4 | 16px |
p-6 | 24px |
gap-8 | 32px |
Earlier installations may have added --spacing: 4px to your stylesheet. Remove that declaration if you want to restore your app’s spacing scale; updating components does not remove it.
Use text-toolbox-title, text-toolbox-subheading, and text-toolbox-body for Material text sizes with matching weight and line height. min-h-toolbox-touch provides a 48px target, and max-w-toolbox-prose keeps reading lines comfortable. These utilities are included by the registry.
Color utilities such as bg-toolbox-primary and text-toolbox-text-secondary follow the nearest theme. Card content and actions already include their Material padding.
Use 16px content insets on phones and 24px on larger screens, and allow 48px interaction areas even when an icon or button is visually smaller. Follow the M1 metrics and keylines when composing a page.