Mobile › Foundations

PlankProvider

Wraps your app once. Picks iOS or Material patterns, light or dark, and applies a PlankUI theme, accent, style and corner radius to every component.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { PlankProvider, ToastProvider, useTheme } from "plankui-mobile";

export default function App() {
  return (
    <PlankProvider theme="ember" look="keycap" accent="blue">
      <ToastProvider>
        <Home />
      </ToastProvider>
    </PlankProvider>
  );
}

// In your own components, read every colour and size from the theme.
function Price({ amount }: { amount: string }) {
  const t = useTheme();
  return <Text style={{ color: t.c.accent }}>{amount}</Text>;
}

iOS and Android

iOS: With no platform set, iPhones, iPads and the web get Apple's patterns and the San Francisco type scale.

Android: Android devices get Material 3 patterns, Roboto sizes and 48 dp touch targets.

API reference

PropTypeDefaultDescription
theme"volt" | "ember" | "grove" | "nebula" | "terminal" | "candy""volt"PlankUI theme: paper, ink and accent colours.
look"soft" | "flat" | "glass" | "keycap" | "brutal""soft"PlankUI component style: shadows, outlines, glass, keycap edges or brutal blocks.
accent"blue" | "violet" | "emerald" | "vermilion" | "rose" | "amber" | "mono" | stringtheme's ownAn accent preset or any hex colour.
radiusnumber1Corner multiplier, 0 (square) to 2.
platform"ios" | "android"the deviceForce one platform's patterns. The web gets iOS.
scheme"light" | "dark"the systemForce light or dark.
fonts{ body?: string; display?: string }–Font families you have loaded with expo-font.

useTheme()

PropTypeDefaultDescription
os"ios" | "android"Which platform's patterns are drawn.
scheme"light" | "dark"The current appearance.
cColorsbg, grouped, surface, fill, field, ink, ink2, muted, rule, accent, onAccent, danger, success, warning and more.
lookLookThe style: r() for radii, card, field and button styles.
typeTypeScaleThe platform's type scale, largeTitle to caption.
hitnumberMinimum touch target: 44 on iOS, 48 on Android.
wash(color?) => stringA faint tint of a colour for backgrounds.