Skip to main content

Documentation Index

Fetch the complete documentation index at: https://copylabs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Typography

Radix Themes Native provides a comprehensive typography system with font sizes, weights, and line heights designed for optimal readability.

Font Size Scale

The typography scale includes 9 sizes:
SizeFont SizeLine HeightLetter SpacingUse Case
111px16px0.5pxFine print, captions
212px18px0.5pxSmall text, labels
314px20px0.25pxBody text (default)
416px24px0pxLarge body text
518px26px-0.25pxSubheadings
620px28px-0.25pxHeadings
724px32px-0.5pxLarge headings
830px36px-0.5pxDisplay headings
936px40px-0.75pxHero text

Using Typography

Text Component

import { Text } from 'radix-native-ui';

<Text size={1}>Small text</Text>
<Text size={3}>Regular text (default)</Text>
<Text size={5}>Large text</Text>

Heading Component

import { Heading } from 'radix-native-ui';

<Heading size={1}>H1 Heading</Heading>
<Heading size={3}>H3 Heading</Heading>
<Heading size={5}>H5 Heading</Heading>

Font Weights

WeightValueUse Case
light300Subtle text
regular400Body text
medium500Emphasis
bold700Strong emphasis
<Text weight="light">Light text</Text>
<Text weight="regular">Regular text</Text>
<Text weight="medium">Medium text</Text>
<Text weight="bold">Bold text</Text>

Accessing Typography Values

Through Theme Object

import { useTheme } from 'radix-native-ui';

function CustomText() {
  const theme = useTheme();

  const fontSize3 = theme.fontSizes[3];
  // { fontSize: 14, lineHeight: 20, letterSpacing: 0.25 }

  return (
    <Text style={{
      fontSize: fontSize3.fontSize,
      lineHeight: fontSize3.lineHeight,
    }}>
      Custom styled text
    </Text>
  );
}

Font Weights

import { useTheme } from 'radix-native-ui';

function Component() {
  const theme = useTheme();

  const boldWeight = theme.fontWeights.bold; // '700'

  return (
    <Text style={{ fontWeight: boldWeight }}>
      Bold text
    </Text>
  );
}

Custom Fonts

Setting Custom Fonts

Configure custom fonts through ThemeProvider:
<ThemeProvider
  themeOptions={{
    fonts: {
      heading: {
        fontFamily: 'CustomFont-Bold',
        fontWeight: '700',
      },
      body: {
        fontFamily: 'CustomFont-Regular',
        fontWeight: '400',
      },
    },
  }}
>
  <App />
</ThemeProvider>

Loading Custom Fonts (Expo)

import { useFonts } from 'expo-font';
import { ThemeProvider } from 'radix-native-ui';

function App() {
  const [fontsLoaded] = useFonts({
    'CustomFont-Regular': require('./assets/fonts/CustomFont-Regular.ttf'),
    'CustomFont-Bold': require('./assets/fonts/CustomFont-Bold.ttf'),
  });

  if (!fontsLoaded) {
    return null;
  }

  return (
    <ThemeProvider
      themeOptions={{
        fonts: {
          heading: { fontFamily: 'CustomFont-Bold' },
          body: { fontFamily: 'CustomFont-Regular' },
        },
      }}
    >
      <AppContent />
    </ThemeProvider>
  );
}

Typography Components

Text

General-purpose text component:
<Text size={3} weight="medium" color="blue">
  Styled text
</Text>

Heading

Semantic heading component:
<Heading size={4} weight="bold">
  Section Title
</Heading>

Strong

Bold text for emphasis:
<Text>
  This is <Strong>important</Strong> text.
</Text>

Em

Italic text for emphasis:
<Text>
  This is <Em>emphasized</Em> text.
</Text>

Code

Inline code styling:
<Text>
  Use the <Code>useState</Code> hook for state.
</Text>

Kbd

Keyboard shortcut styling:
<Text>
  Press <Kbd>Cmd + C</Kbd> to copy.
</Text>

Best Practices

  1. Use semantic sizes - Size 3 for body, size 4-5 for subheadings, size 6+ for headings
  2. Maintain hierarchy - Don’t skip heading sizes
  3. Consider line height - The default line heights are optimized for readability
  4. Test on device - Font rendering can vary between iOS and Android