Recipes

Recipes

Each recipe is a worked solution to one problem — start to finish, with the code you need. Where a concept page explains how motif thinks, a recipe shows you what to type.

Updated todayEdit on GitHubWeb & native

Patterns

Build a feature or solve a styling problem against motif's runtime.

RecipeWhat you build
Dark mode toggleA three-way light/dark/system toggle on useThemeSetting, with no first-paint flash.
Build a design systemA typed, themed design system — tokens, primitives, components packaged for consumers.
Theming CMS contentA per-section theme for content loaded from a CMS — pre-registered or runtime themes.
AnimationProp-change transitions, mount-in entrances, and unmount-out exits with motion props.
FormsAccessible forms with Field, Label, Input, FieldHelp, and FieldError.
Sub-themes per routeA route or route group with its own Theme boundary or theme chain.
Print stylesA print stylesheet — paper tokens, hidden chrome, controlled page breaks.

Migrating from another library

Move an existing codebase onto motif. Each recipe maps the old idioms to motif's, with a worked example and an honest account of where the two libraries genuinely differ.

RecipeComing from
Migrate from styled-componentsstyled-components
Migrate from EmotionEmotion
Migrate from TailwindTailwind
Migrate from TamaguiTamagui