npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rn-lab/design-system

v1.0.6

Published

Production-ready React Native design system SDK

Readme

🎨 @rn-lab/design-system

A production-grade, highly scalable, and fully type-safe React Native Design System SDK. Built to enforce consistent typography, colors, and layouts across your applications with zero friction.

✨ Features

  • 100% Type-Safe: Built with TypeScript, providing rich autocomplete for all your theme tokens, colors, and fonts.
  • Dynamic Theming: Seamless Light and Dark mode switching out of the box.
  • Powerful Typography: Generate static and dynamic font styles dynamically without writing boilerplate.
  • Responsive Layouts: Built-in breakpoint system (xs, md, lg) tailored for cross-device scaling.
  • Accessibility Ready: First-class support for RTL (Right-to-Left) and layout snapshotting.
  • Performance Optimized: Uses memoized style creators for fast, jank-free rendering.

📦 Installation

This package is designed as an internal workspace dependency or published NPM module.

npm install @rn-lab/design-system
# or
yarn add @rn-lab/design-system

(Note: Requires react >= 18.0.0 and react-native >= 0.72.0)


🛠 Core Utilities

The design system exposes several specialized utilities to architect your app's presentation layer seamlessly.

1. createProjectTheme

Defines your global design language, including semantic colors, spacing, radius, and shadows. It automatically constructs and maps your light and dark mode tokens.

import { createProjectTheme } from "@rn-lab/design-system";

export const projectTheme = createProjectTheme({
  lightColors: {
    background: "#FFFFFF",
    surface: "#F5F5F5",
    primary: "#0A0A0A",
    text: "#111111",
    accent: "#FF4D00",
  },
  darkColors: {
    background: "#0A0A0A",
    surface: "#1A1A1A",
    primary: "#FFFFFF",
    text: "#F5F5F5",
    accent: "#FF6B35",
  },
});

2. createFontConfig

Generates a structured, fully-typed typography configuration. It supports static variants (e.g., InterBoldMd) and dynamic functions for custom sizing requirements (e.g., _InterBold(24)).

import { createFontConfig } from "@rn-lab/design-system";

export const fontConfig = createFontConfig({
  families: {
    Inter: {
      variants: {
        Regular: "Inter-Regular",
        SemiBold: "Inter-SemiBold",
        Bold: "Inter-Bold",
      },
    },
  },
  sizes: {
    xs: 11,
    sm: 13,
    md: 16,
    lg: 20,
    xl: 24,
  },
});

3. createThemeKit

Binds your initialized projectTheme to React Native hooks, ensuring strongly-typed access across your entire project.

import { createThemeKit } from "@rn-lab/design-system";

export const { useTheme, createStyles, createDynamicStyles } =
  createThemeKit(projectTheme);

4. ThemeProvider

The root provider that watches system theme changes, overrides, and supplies your theme context down the React tree.

import { ThemeProvider } from "@rn-lab/design-system";

export function App() {
  return (
    <ThemeProvider projectTheme={projectTheme} followSystem>
      <AppNavigation />
    </ThemeProvider>
  );
}

💻 Usage Patterns

Once configured, use your generated hooks to style components effortlessly while retaining strict TypeScript validations.

Static Styling (Recommended)

createStyles is the preferred way to generate styles that depend on the theme, executing only when the theme changes (saving valuable render cycles).

const useStyles = createStyles((theme) => ({
  container: {
    backgroundColor: theme.colors.surface,
    padding: theme.spacing.lg,
    borderRadius: theme.radius.md,
    ...theme.shadows.base.md, // Pre-configured drop shadows
  },
  title: {
    color: theme.colors.text,
    ...fontConfig.InterBoldMd, // Type-safe typography token
  },
}));

function DemoCard() {
  const styles = useStyles();

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Hello Design System</Text>
    </View>
  );
}

Dynamic Styling

When component styles must react to local props or state, use createDynamicStyles.

const useDynamicStyles = createDynamicStyles((theme, size: number) => ({
  customText: {
    color: theme.colors.accent,
    ...fontConfig._InterBold(size), // Invoke dynamic font sizing
  },
}));

function DynamicText({ size = 18 }) {
  const styles = useDynamicStyles(size);
  return <Text style={styles.customText}>I adapt to props!</Text>;
}

Direct Theme Access & Responsiveness

Extract theme for responsive viewport checks, layout parameters, or RTL capabilities inline.

function ActionArea() {
  const { theme, toggleTheme } = useTheme();

  return (
    <View style={{ padding: theme.responsive({ xs: 16, md: 24, lg: 32 }) }}>
      <Text>Current Mode: {theme.mode}</Text>
      <Text>Layout Direction: {theme.accessibility.dir()}</Text>

      <TouchableOpacity onPress={toggleTheme}>
        <Text>Toggle Appearance</Text>
      </TouchableOpacity>
    </View>
  );
}

⚡️ Performance & Optimization

This design system is built from the ground up to guarantee 60 FPS in React Native by minimizing bridge traffic and preventing unnecessary re-renders:

  • Memoized Style Creators: createStyles caches the generated stylesheet based on the active theme. Your components will never recreate styles on every render unless the theme mode (light/dark) explicitly changes.
  • Reference Equality: Hook outputs (useTheme()) return stable object references, preventing your child components from re-rendering if they use React.memo.
  • Zero-Cost Abstractions: There are no heavy runtime UI component wrappers. This SDK gives you raw StyleSheet.create performance while injecting dynamic theme values effortlessly.
  • Lazy Evaluation: Dynamic styling via createDynamicStyles only recalculates when specific dependencies (like custom prop values) change, heavily optimizing complex list items and interactive components.

🧠 Architecture Philosophy

  • Separation of Concerns: Themes, Fonts, and Kits are instantiated modularly to prevent heavy bundle sizes and circular dependencies.
  • Frictionless DX: Strict auto-completion ensures developers never mistype a color, spacing tier, or font variant.
  • Scalability First: Add new color keys or font scales to the configuration, and your app's definitions will infer and update globally.