Loading...
Loading...
Framework (OSS). Build and maintain a design system inside an Expo app - a reusable theme of design tokens (color, spacing, typography, radius, shadow, motion), reusable component structure with variant/size/state prop conventions, and rules for when to extract a repeated view into a shared component. Use when creating or organizing theme files and design tokens (theme.ts / theme/), extending an existing theme or styling library (NativeWind, Tamagui, Restyle, Unistyles) in its own idiom, standardizing styles so screens (including AI-generated ones) look consistent and polished, building an in-app component library, or auditing an app for design-system drift (hardcoded colors, spacing, fonts). For platform styling specifics (semantic colors, HIG rules, native controls) use expo-native-ui; for Tailwind/CSS setup use expo-tailwind-setup; for folder layout of a new app use expo-project-structure.
npx skill4agent add expo/skills expo-design-systemexpo-native-uiexpo-tailwind-setupglobal.cssexpo-project-structurereferences/
audit.md Audit an existing app for design-system drift: grep checks,
scoring rubric, incremental adoption plan, and templates for
documenting or extending componentspackage.jsonexpo-tailwind-setuptheme.tssrc/theme/constants/theme.tsconstants/Colors.tsreferences/audit.mdsrc/theme/src/theme/src/create-expo-appapp/components/constants/theme/constants/src/theme/
colors.ts # see expo-native-ui "Colors" for the palette pattern
spacing.ts
typography.ts
radius.ts
shadows.ts
motion.ts
index.ts # re-exports everything: import { spacing, type } from "@/theme"src/theme.tsspacingsrc/theme/Colorexpo-routerPlatform.selecttheme/colors.tsexpo-native-ui// theme/colors.ts
import { Platform } from "react-native";
import { Color } from "expo-router";
export const colors = {
label: Platform.select({
ios: Color.ios.label,
android: Color.android.dynamic.onSurface,
default: "#000000",
})!,
secondaryLabel: Platform.select({
ios: Color.ios.secondaryLabel,
android: Color.android.dynamic.onSurfaceVariant,
default: "#3c3c43",
})!,
separator: Platform.select({
ios: Color.ios.separator,
android: Color.android.dynamic.outlineVariant,
default: "#c6c6c8",
})!,
systemBackground: Platform.select({
ios: Color.ios.systemBackground,
android: Color.android.dynamic.surface,
default: "#ffffff",
})!,
systemBlue: Platform.select({
ios: Color.ios.systemBlue,
android: Color.android.dynamic.primary,
default: "#007aff",
})!,
// Deliberately fixed: text on a tinted (accent) surface stays white in both modes.
onTint: "#ffffff",
};// theme/colors.ts (brand additions)
import { useColorScheme } from "react-native";
const brandPalette = {
light: { accent: "#5B21B6", accentContrast: "#FFFFFF" },
dark: { accent: "#A78BFA", accentContrast: "#1E1B4B" },
} as const;
export function useBrandColors() {
const scheme = useColorScheme();
return brandPalette[scheme === "dark" ? "dark" : "light"];
}colorstheme/typography.tsuseBrandColors()typevariantsDynamicColorIOS// theme/spacing.ts
export const spacing = {
xs: 4,
sm: 8,
md: 16,
lg: 24,
xl: 32,
xxl: 48,
} as const;gapexpo-native-uispacing.md// theme/typography.ts
import { TextStyle } from "react-native";
import { colors } from "./colors";
export const type = {
largeTitle: { fontSize: 34, fontWeight: "700", color: colors.label },
title: { fontSize: 22, fontWeight: "600", color: colors.label },
headline: { fontSize: 17, fontWeight: "600", color: colors.label },
body: { fontSize: 17, fontWeight: "400", color: colors.label },
subhead: { fontSize: 15, fontWeight: "400", color: colors.secondaryLabel },
caption: { fontSize: 12, fontWeight: "400", color: colors.secondaryLabel },
} as const satisfies Record<string, TextStyle>;expo-fontfontFamilyfontWeightheadline: { fontSize: 17, fontFamily: "SFProRounded-Semibold", color: colors.label },fontSize// components/themed-text.tsx
import { Text, TextProps } from "react-native";
import { type } from "@/theme";
export function ThemedText({
variant = "body",
style,
...props
}: TextProps & { variant?: keyof typeof type }) {
return <Text style={[type[variant], style]} {...props} />;
}expo-native-uilargeTitle// theme/radius.ts
export const radius = {
sm: 8,
md: 12,
lg: 16,
full: 9999, // capsules
} as const;borderCurve: "continuous"expo-native-uiboxShadowexpo-native-ui// theme/shadows.ts
export const shadows = {
card: "0 1px 2px rgba(0, 0, 0, 0.05)",
raised: "0 4px 12px rgba(0, 0, 0, 0.10)",
overlay: "0 8px 24px rgba(0, 0, 0, 0.18)",
} as const;// theme/motion.ts
export const motion = {
fast: 150, // state feedback: press, toggle
base: 250, // element transitions: enter/exit
slow: 400, // large surfaces: sheets, screens
} as const;ColorPlatformColorexpo-native-uisrc/components/expo-project-structureprimarysecondaryghostdestructivesmmdlgmdPressablestyle// components/button.tsx
import { Pressable, ActivityIndicator, ViewStyle, StyleProp } from "react-native";
import { colors, spacing, radius } from "@/theme";
import { ThemedText } from "./themed-text";
const variants = {
primary: { backgroundColor: colors.systemBlue, color: colors.onTint },
secondary: { backgroundColor: colors.separator, color: colors.label },
} as const;
const sizes = {
sm: { paddingVertical: spacing.xs, paddingHorizontal: spacing.sm },
md: { paddingVertical: spacing.sm, paddingHorizontal: spacing.md },
} as const;
export function Button({
variant = "primary",
size = "md",
title,
loading,
disabled,
style,
onPress,
}: {
variant?: keyof typeof variants;
size?: keyof typeof sizes;
title: string;
loading?: boolean;
disabled?: boolean;
style?: StyleProp<ViewStyle>;
onPress?: () => void;
}) {
return (
<Pressable
accessibilityRole="button"
disabled={disabled || loading}
onPress={onPress}
style={({ pressed }) => [
{
backgroundColor: variants[variant].backgroundColor,
borderRadius: radius.md,
borderCurve: "continuous",
alignItems: "center",
opacity: disabled ? 0.4 : pressed ? 0.7 : 1,
...sizes[size],
},
style, // caller overrides merge last
]}
>
{loading ? (
<ActivityIndicator color={variants[variant].color as string} />
) : (
<ThemedText variant="headline" style={{ color: variants[variant].color }}>
{title}
</ThemedText>
)}
</Pressable>
);
}leftIconsubtitlefooterTextbadgeCountchildrenCardchildrenCardsrc/components/screens/<name>/expo-project-structurescreens/<name>/src/components/SwitchDateTimePicker@expo/ui| Decision | Lives in | Example |
|---|---|---|
| A visual value used anywhere twice | | brand accent, spacing step |
| Structure + variants of a reused element | | Button, Card, EmptyState |
| One screen's private composition | | profile header layout |
| One-off local adjustment | inline, with a comment | optical nudge on an icon |
| Screen titles, top-level chrome | navigation stack options | header title, large title |
typegap./references/audit.mdnpx --yes submit-expo-feedback@latest --category skills --subject "expo-design-system" "<actionable feedback>"