Skip to content

Border Radius (React Native) ​

Border radius tokens are available via theme.radius from the useGrundtoneTheme() hook.


Radius Scale ​

TokenValuePixels
none00
xs0.125rem2px
sm0.25rem4px
md0.375rem6px
lg0.5rem8px
xl0.75rem12px
2xl1rem16px
3xl1.5rem24px
full9999px9999px

Usage ​

Radius values are rem strings. Convert to numbers for React Native:

tsx
import { useGrundtoneTheme } from '@grundtone/react-native';

const REM_BASE = 16;
const rem = (value: string) => parseFloat(value) * REM_BASE;

function Card({ children }) {
  const { theme } = useGrundtoneTheme();

  return (
    <View
      style={{
        borderRadius: rem(theme.radius.lg), // 8
        backgroundColor: theme.colors.surface,
        padding: 16,
      }}
    >
      {children}
    </View>
  );
}

Common Patterns ​

Avatar (fully round) ​

tsx
function Avatar({ uri, size = 48 }) {
  const { theme } = useGrundtoneTheme();

  return (
    <Image
      source={{ uri }}
      style={{
        width: size,
        height: size,
        borderRadius: size / 2,
      }}
    />
  );
}

For fully round elements, use size / 2 instead of theme.radius.full — the 9999px value works in CSS but RN clips at the actual dimension.

Per-corner radius ​

tsx
function TopSheet({ children }) {
  const { theme } = useGrundtoneTheme();

  return (
    <View
      style={{
        borderTopLeftRadius: rem(theme.radius.xl),  // 12
        borderTopRightRadius: rem(theme.radius.xl), // 12
        borderBottomLeftRadius: 0,
        borderBottomRightRadius: 0,
        backgroundColor: theme.colors.surface,
        padding: 16,
      }}
    >
      {children}
    </View>
  );
}

Chip / tag ​

tsx
function Chip({ label }) {
  const { theme } = useGrundtoneTheme();

  return (
    <View
      style={{
        borderRadius: rem(theme.radius['2xl']), // 16
        backgroundColor: theme.colors.primaryLight,
        paddingVertical: 4,
        paddingHorizontal: 12,
      }}
    >
      <Text style={{ fontSize: 13, color: theme.colors.primary }}>
        {label}
      </Text>
    </View>
  );
}