WDK logoWDK documentation

Theming

Learn how to add your own branding to the UI Kit

The WDK React Native UI Kit provides a theming system that allows you to:

  • Use built-in themes for quick setup with light and dark modes
  • Create brand themes from your brand colors and fonts
  • Customize individual components with fine-grained control
  • Access theme values anywhere in your application
  • Switch themes dynamically based on user preferences

Basic Setup

Wrap your app with the ThemeProvider to enable theming:

Basic Theme Setup
import { ThemeProvider, lightTheme } from '@tetherto/wdk-uikit-react-native'

function App() {
  return (
    <ThemeProvider initialTheme={lightTheme}>
      {/* Your app content */}
    </ThemeProvider>
  )
}

The UI Kit comes with two built-in themes:

import { ThemeProvider, lightTheme, darkTheme } from '@tetherto/wdk-uikit-react-native'

// Light theme
<ThemeProvider initialTheme={lightTheme}>
  {/* Your app */}
</ThemeProvider>

// Dark theme
<ThemeProvider initialTheme={darkTheme}>
  {/* Your app */}
</ThemeProvider>

Manual Theme Control

Manual Theme Toggle
import { useTheme } from '@tetherto/wdk-uikit-react-native'

function ThemeToggle() {
  const { mode, setMode } = useTheme()

  return (
    <Button onPress={() => setMode(mode === 'dark' ? 'light' : 'dark')}>
      Toggle Theme
    </Button>
  )
}

Custom Themes

Brand Themes

Apply your brand colors and fonts using createThemeFromBrand:

Brand Theme Creation
import { ThemeProvider, createThemeFromBrand } from '@tetherto/wdk-uikit-react-native'

const brandTheme = createThemeFromBrand({
  primaryColor: '#007AFF',
  secondaryColor: '#FF3B30',
  fontFamily: {
    regular: 'Inter-Regular',
    bold: 'Inter-Bold',
  },
}, 'light')

<ThemeProvider initialTheme={brandTheme}>
  {/* Your branded app */}
</ThemeProvider>

BrandConfig Interface

BrandConfig Type
type BrandConfig = {
  primaryColor: string
  secondaryColor?: string
  fontFamily?: {
    regular?: string
    medium?: string
    semiBold?: string
    bold?: string
  }
}

Custom Theme

Create a completely custom theme with full control over all design tokens:

Custom Theme
import { ThemeProvider } from '@tetherto/wdk-uikit-react-native'

const myLightTheme = {
  mode: 'light' as const,
  colors: {
    primary: '#007AFF',
    primaryLight: '#4DA6FF',
    primaryDark: '#0056CC',
    onPrimary: '#FFFFFF',
    secondary: '#FF3B30',
    secondaryLight: '#FF6B60',
    secondaryDark: '#CC2F26',
    background: '#FFFFFF',
    surface: '#F9FAFB',
    surfaceVariant: '#F3F4F6',
    surfaceElevated: '#E5E7EB',
    text: '#111827',
    textSecondary: '#6B7280',
    textDisabled: '#9CA3AF',
    border: '#E5E7EB',
    borderLight: '#F3F4F6',
    error: '#EF4444',
    warning: '#F59E0B',
    success: '#10B981',
    info: '#3B82F6',
  },
  typography: {
    fontFamily: { 
      regular: 'System', 
      medium: 'System', 
      semiBold: 'System', 
      bold: 'System' 
    },
    fontSize: { 
      xs: 10, sm: 12, base: 14, md: 16, lg: 18, xl: 20, xxl: 24, xxxl: 30 
    },
    fontWeight: { 
      regular: '400', medium: '500', semiBold: '600', bold: '700' 
    },
  },
  spacing: { 
    xs: 4, sm: 8, base: 12, md: 16, lg: 24, xl: 32, xxl: 48, xxxl: 64 
  },
  borderRadius: { 
    none: 0, sm: 4, md: 8, lg: 16, xl: 24, xxl: 32, full: 9999 
  },
}

<ThemeProvider customLightTheme={myLightTheme}>
  {/* Your app */}
</ThemeProvider>

Theme Interface

Theme Type
type Theme = {
  mode: 'light' | 'dark' | 'auto'
  colors: ColorPalette
  typography: Typography
  spacing: Spacing
  borderRadius: BorderRadius
  componentVariants?: ComponentVariant
  componentOverrides?: ComponentOverrides
}

Component Customization

You can customize the components with fine-grained control.

Fine-grained style overrides for specific component parts:

Component Overrides
<ThemeProvider
  initialTheme={lightTheme}
  componentOverrides={{
    TransactionItem: {
      container: {
        backgroundColor: '#F5F5F5',
        borderRadius: 12,
      },
      title: {
        fontSize: 18,
        fontWeight: 'bold',
      },
    },
    TransactionList: {
      emptyStateText: {
        color: '#999999',
      },
    },
  }}
>
  {/* Your app */}
</ThemeProvider>

Set default visual variants per component:

Component Variants
const customTheme = {
  ...lightTheme,
  componentVariants: {
    'AmountInput.default': { /* variant styles */ },
    'TransactionItem.compact': { /* variant styles */ }
  }
}

Using Theme Anywhere

Access theme values anywhere in your components:

useTheme Hook

useTheme Hook
import { useTheme } from '@tetherto/wdk-uikit-react-native'

function MyComponent() {
  const { theme } = useTheme()

  return (
    <View
      style={{
        backgroundColor: theme.colors.background,
        padding: theme.spacing.md,
      }}
    >
      <Text style={{ color: theme.colors.text }}>Hello World</Text>
    </View>
  )
}

Theme Structure

Color Palette

The theming system uses semantic naming for colors:

TokenPurpose
colors.primaryPrimary brand color
colors.primaryLightLight variant of primary
colors.primaryDarkDark variant of primary
colors.onPrimaryText color on primary background
colors.secondarySecondary brand color
colors.secondaryLightLight variant of secondary
colors.secondaryDarkDark variant of secondary
colors.backgroundMain background color
colors.surfaceCard/container background
colors.surfaceVariantAlternative surface color
colors.surfaceElevatedElevated surface color
colors.textPrimary text color
colors.textSecondarySecondary text color
colors.textDisabledDisabled text color
colors.borderBorder color
colors.borderLightLight border color
colors.errorError state color
colors.warningWarning state color
colors.successSuccess state color
colors.infoInfo state color

Typography

TokenPurpose
typography.fontFamily.regularRegular font family
typography.fontFamily.mediumMedium font family
typography.fontFamily.semiBoldSemi-bold font family
typography.fontFamily.boldBold font family
typography.fontSize.xsExtra small font size (10px)
typography.fontSize.smSmall font size (12px)
typography.fontSize.baseBase font size (14px)
typography.fontSize.mdMedium font size (16px)
typography.fontSize.lgLarge font size (18px)
typography.fontSize.xlExtra large font size (20px)
typography.fontSize.xxl2X large font size (24px)
typography.fontSize.xxxl3X large font size (30px)
typography.fontWeight.regularRegular font weight ('400')
typography.fontWeight.mediumMedium font weight ('500')
typography.fontWeight.semiBoldSemi-bold font weight ('600')
typography.fontWeight.boldBold font weight ('700')

Spacing

TokenPurpose
spacing.xsExtra small spacing (4px)
spacing.smSmall spacing (8px)
spacing.baseBase spacing (12px)
spacing.mdMedium spacing (16px)
spacing.lgLarge spacing (24px)
spacing.xlExtra large spacing (32px)
spacing.xxl2X large spacing (48px)
spacing.xxxl3X large spacing (64px)

Border Radius

TokenPurpose
borderRadius.noneNo border radius (0px)
borderRadius.smSmall border radius (4px)
borderRadius.mdMedium border radius (8px)
borderRadius.lgLarge border radius (16px)
borderRadius.xlExtra large border radius (24px)
borderRadius.xxl2X large border radius (32px)
borderRadius.fullFull border radius (9999px)

Advanced Usage

Dynamic Theme Updates

Update themes dynamically at runtime:

Dynamic Theme Updates
function Settings() {
  const { setBrandConfig, setComponentOverrides } = useTheme()

  const updateBrand = () => {
    setBrandConfig({
      primaryColor: '#FF6501',
    })
  }

  const customizeTransactions = () => {
    setComponentOverrides({
      TransactionItem: {
        container: {
          backgroundColor: 'rgba(255, 101, 1, 0.1)',
        },
      },
    })
  }

  return (
    <>
      <Button onPress={updateBrand}>Update Brand</Button>
      <Button onPress={customizeTransactions}>Customize Transactions</Button>
    </>
  )
}

Next Steps


Need Help?

On this page