Style

Theme tokens, style primitives, and sx helpers for Lattice UI.

Stable direction
@lattice-ui/style

Part of the stable direction toward v1.0.

What It Is For

Use @lattice-ui/style as the default baseline for product UI styling in Lattice UI apps.

It provides theme tokens, primitive text/box helpers, sx composition, and reusable recipes without dictating app structure.

Preview size

Live demo is experimental and may contain bugs.

Install

Global CLI command: lattice add style

Monorepo local script

Use your package manager wrapper when running the local lattice command.

pnpm lattice add style

npm package: @lattice-ui/style

Peer dependencies

  • @rbxts/react
  • @rbxts/react-roblox

Public Exports

  • Box
  • Text
  • createRecipe
  • mergeGuiProps
  • mergeSx
  • resolveSx
  • ThemeProvider
  • useTheme
  • useThemeValue
  • createTheme
  • defaultDarkTheme
  • defaultLightTheme

State Model

  • ThemeProvider owns the current theme object and exposes it through useTheme and useThemeValue.
  • createRecipe and mergeSx are pure style composition tools; they do not create runtime state on their own.
  • Theme tokens cover colors, spacing, radius, and typography, and other packages read from that theme model rather than duplicating scales.

Key API

ThemeProvider

Use theme, defaultTheme, and onThemeChange when your app needs controlled or uncontrolled theme ownership.

createRecipe

Use recipes to centralize visual variants instead of scattering conditional prop objects across your UI.

mergeGuiProps

Use this to layer base, variant, and caller overrides while composing Event and Change handlers instead of replacing them.

Box / Text

Use primitives for token-driven structure and typography without reaching directly for raw Roblox hosts everywhere.

Composition Patterns

Theme-backed product surfaces

Define recipes once, then apply them across buttons, panels, and labels so visual language stays coherent.

Custom component skins

Pair useTheme with headless packages like TextField or Select so semantics and visuals stay decoupled.

Cautions / Limits

  • style handles visual language, not app-level layout or density orchestration; use system for that layer.
  • If you bypass tokens with one-off values everywhere, the package stops paying for itself quickly.