# rootnative/ui architecture

> Architecture diagram of the GitHub repository rootnative/ui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rootnative/ui
- Repository: https://github.com/rootnative/ui

## Overview

RootNative UI is a React Native design-system library with a companion project-scaffolding CLI. The main app workflow is theme setup, then consuming responsive, accessible UI components; the CLI separately creates or initializes projects and installs or updates component source. The graph preserves the documented theme, icon, component, and CLI capabilities. Several subsystem links are based on README statements or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`packages/cli/src/index.ts`](https://github.com/rootnative/ui/blob/main/packages/cli/src/index.ts) (CLI command router), [`packages/cli/src/commands/add.ts`](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/add.ts) (Add components), [`packages/components/src/search-view/SearchView.tsx`](https://github.com/rootnative/ui/blob/main/packages/components/src/search-view/SearchView.tsx) (Search view), [`packages/core/src/provider/ThemeProvider.tsx`](https://github.com/rootnative/ui/blob/main/packages/core/src/provider/ThemeProvider.tsx) (Theme provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Theme engine"]
  node_theme_provider["Theme provider<br/>[ThemeProvider.tsx]"]
  node_theme_system["Themes and tokens"]
  node_responsive["Responsive utilities<br/>[useBreakpoint.ts]"]
  node_hydration["Hydration-safe sizing"]
end

subgraph group_ui["UI components"]
  node_components["UI component library<br/>[index.ts]"]
  node_controls["Inputs and actions<br/>[Button.tsx]"]
  node_layout["Layout and typography<br/>[Layout.tsx]"]
  node_surfaces["Cards and surfaces<br/>[Card.tsx]"]
  node_overlays["Dialogs and menus<br/>[Dialog.tsx]"]
  node_portal["Portal rendering<br/>[Portal.tsx]"]
  node_search["Search view<br/>[SearchView.tsx]"]
  node_focus_trap["Focus management<br/>[useFocusTrap.ts]"]
  node_feedback["Progress and feedback"]
  node_navigation["Navigation components<br/>[NavigationBar.tsx]"]
end

subgraph group_icons["Icon adapters"]
  node_icons["Icon resolver adapters"]
  node_icon_resolver["Resolver builder<br/>[buildResolver.ts]"]
end

subgraph group_cli["Project CLI"]
  node_cli_entry["CLI command router<br/>[index.ts]"]
  node_create["Create project<br/>[create.ts]"]
  node_initialize["Initialize project<br/>[init.ts]"]
  node_add["Add components<br/>[add.ts]"]
  node_update["Update components<br/>[update.ts]"]
  node_upgrade["Upgrade dependencies<br/>[upgrade.ts]"]
  node_inspect["List and diagnose<br/>[doctor.ts]"]
  node_registry["Component registry<br/>[registry.ts]"]
  node_resolver["Dependency resolver<br/>[resolver.ts]"]
  node_installer["Source installer<br/>[installer.ts]"]
end

subgraph group_templates["Starter templates"]
  node_templates["Expo starter templates<br/>[App.tsx]"]
end

node_app_author(("App developer"))

node_app_author -->|"wraps app"| node_theme_provider
node_theme_provider -.->|"provides theme"| node_theme_system
node_app_author -->|"uses components"| node_components
node_theme_provider -->|"themes components"| node_components
node_responsive -->|"reads dimensions"| node_hydration
node_search -->|"traps focus"| node_focus_trap
node_search -->|"renders through"| node_portal
node_search -->|"renders buttons"| node_controls
node_app_author -->|"configures resolver"| node_icons
node_icons -->|"uses builder"| node_icon_resolver
node_app_author -->|"runs CLI"| node_cli_entry
node_cli_entry -->|"dispatches create"| node_create
node_cli_entry -->|"dispatches init"| node_initialize
node_cli_entry -->|"dispatches add"| node_add
node_cli_entry -->|"dispatches update"| node_update
node_cli_entry -->|"dispatches upgrade"| node_upgrade
node_cli_entry -->|"dispatches checks"| node_inspect
node_create -->|"scaffolds from"| node_templates
node_initialize -->|"reads version"| node_registry
node_add -->|"reads entries"| node_registry
node_add -->|"resolves dependencies"| node_resolver
node_add -->|"installs files"| node_installer
node_update -->|"reads entries"| node_registry
node_upgrade -->|"optionally updates files"| node_update

click node_theme_provider "https://github.com/rootnative/ui/blob/main/packages/core/src/provider/ThemeProvider.tsx"
click node_theme_system "https://github.com/rootnative/ui/blob/main/packages/core/src/theme/createMaterialTheme.ts"
click node_responsive "https://github.com/rootnative/ui/blob/main/packages/core/src/responsive/useBreakpoint.ts"
click node_hydration "https://github.com/rootnative/ui/blob/main/packages/core/src/responsive/useWindowDimensions.ts"
click node_components "https://github.com/rootnative/ui/blob/main/packages/components/src/index.ts"
click node_controls "https://github.com/rootnative/ui/blob/main/packages/components/src/button/Button.tsx"
click node_layout "https://github.com/rootnative/ui/blob/main/packages/components/src/layout/Layout.tsx"
click node_surfaces "https://github.com/rootnative/ui/blob/main/packages/components/src/card/Card.tsx"
click node_overlays "https://github.com/rootnative/ui/blob/main/packages/components/src/dialog/Dialog.tsx"
click node_portal "https://github.com/rootnative/ui/blob/main/packages/components/src/portal/Portal.tsx"
click node_search "https://github.com/rootnative/ui/blob/main/packages/components/src/search-view/SearchView.tsx"
click node_focus_trap "https://github.com/rootnative/ui/blob/main/packages/components/src/internal/useFocusTrap.ts"
click node_feedback "https://github.com/rootnative/ui/blob/main/packages/components/src/snackbar/SnackbarProvider.tsx"
click node_navigation "https://github.com/rootnative/ui/blob/main/packages/components/src/navigation-bar/NavigationBar.tsx"
click node_icons "https://github.com/rootnative/ui/blob/main/packages/icons/src/createLucideResolver.tsx"
click node_icon_resolver "https://github.com/rootnative/ui/blob/main/packages/icons/src/internal/buildResolver.ts"
click node_cli_entry "https://github.com/rootnative/ui/blob/main/packages/cli/src/index.ts"
click node_create "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/create.ts"
click node_initialize "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/init.ts"
click node_add "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/add.ts"
click node_update "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/update.ts"
click node_upgrade "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/upgrade.ts"
click node_inspect "https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/doctor.ts"
click node_registry "https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/registry.ts"
click node_resolver "https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/resolver.ts"
click node_installer "https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/installer.ts"
click node_templates "https://github.com/rootnative/ui/blob/main/templates/blank/App.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_theme_provider,node_theme_system,node_responsive,node_hydration toneBlue
class node_components,node_controls,node_layout,node_surfaces,node_overlays,node_portal,node_search,node_focus_trap,node_feedback,node_navigation toneAmber
class node_icons,node_icon_resolver toneMint
class node_cli_entry,node_create,node_initialize,node_add,node_update,node_upgrade,node_inspect,node_registry,node_resolver,node_installer toneRose
class node_templates,node_app_author toneIndigo
```

## Components

### Theme engine

- [Theme provider](https://github.com/rootnative/ui/blob/main/packages/core/src/provider/ThemeProvider.tsx): `packages/core/src/provider/ThemeProvider.tsx`
- [Themes and tokens](https://github.com/rootnative/ui/blob/main/packages/core/src/theme/createMaterialTheme.ts): `packages/core/src/theme/createMaterialTheme.ts`
- [Responsive utilities](https://github.com/rootnative/ui/blob/main/packages/core/src/responsive/useBreakpoint.ts): `packages/core/src/responsive/useBreakpoint.ts`
- [Hydration-safe sizing](https://github.com/rootnative/ui/blob/main/packages/core/src/responsive/useWindowDimensions.ts): `packages/core/src/responsive/useWindowDimensions.ts`

### UI components

- [UI component library](https://github.com/rootnative/ui/blob/main/packages/components/src/index.ts): `packages/components/src/index.ts`
- [Inputs and actions](https://github.com/rootnative/ui/blob/main/packages/components/src/button/Button.tsx): `packages/components/src/button/Button.tsx`
- [Layout and typography](https://github.com/rootnative/ui/blob/main/packages/components/src/layout/Layout.tsx): `packages/components/src/layout/Layout.tsx`
- [Cards and surfaces](https://github.com/rootnative/ui/blob/main/packages/components/src/card/Card.tsx): `packages/components/src/card/Card.tsx`
- [Dialogs and menus](https://github.com/rootnative/ui/blob/main/packages/components/src/dialog/Dialog.tsx): `packages/components/src/dialog/Dialog.tsx`
- [Portal rendering](https://github.com/rootnative/ui/blob/main/packages/components/src/portal/Portal.tsx): `packages/components/src/portal/Portal.tsx`
- [Search view](https://github.com/rootnative/ui/blob/main/packages/components/src/search-view/SearchView.tsx): `packages/components/src/search-view/SearchView.tsx`
- [Focus management](https://github.com/rootnative/ui/blob/main/packages/components/src/internal/useFocusTrap.ts): `packages/components/src/internal/useFocusTrap.ts`
- [Progress and feedback](https://github.com/rootnative/ui/blob/main/packages/components/src/snackbar/SnackbarProvider.tsx): `packages/components/src/snackbar/SnackbarProvider.tsx`
- [Navigation components](https://github.com/rootnative/ui/blob/main/packages/components/src/navigation-bar/NavigationBar.tsx): `packages/components/src/navigation-bar/NavigationBar.tsx`

### Icon adapters

- [Icon resolver adapters](https://github.com/rootnative/ui/blob/main/packages/icons/src/createLucideResolver.tsx): `packages/icons/src/createLucideResolver.tsx`
- [Resolver builder](https://github.com/rootnative/ui/blob/main/packages/icons/src/internal/buildResolver.ts): `packages/icons/src/internal/buildResolver.ts`

### Project CLI

- [CLI command router](https://github.com/rootnative/ui/blob/main/packages/cli/src/index.ts): `packages/cli/src/index.ts`
- [Create project](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/create.ts): `packages/cli/src/commands/create.ts`
- [Initialize project](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/init.ts): `packages/cli/src/commands/init.ts`
- [Add components](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/add.ts): `packages/cli/src/commands/add.ts`
- [Update components](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/update.ts): `packages/cli/src/commands/update.ts`
- [Upgrade dependencies](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/upgrade.ts): `packages/cli/src/commands/upgrade.ts`
- [List and diagnose](https://github.com/rootnative/ui/blob/main/packages/cli/src/commands/doctor.ts): `packages/cli/src/commands/doctor.ts`
- [Component registry](https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/registry.ts): `packages/cli/src/lib/registry.ts`
- [Dependency resolver](https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/resolver.ts): `packages/cli/src/lib/resolver.ts`
- [Source installer](https://github.com/rootnative/ui/blob/main/packages/cli/src/lib/installer.ts): `packages/cli/src/lib/installer.ts`

### Starter templates

- [Expo starter templates](https://github.com/rootnative/ui/blob/main/templates/blank/App.tsx): `templates/blank/App.tsx`

### Other components

- **App developer**

## Connections

- App developer → Theme provider: wraps app (evidence: `README.md`)
- Theme provider → Themes and tokens: provides theme
- App developer → UI component library: uses components (evidence: `README.md`)
- Theme provider → UI component library: themes components (evidence: `README.md`)
- Responsive utilities → Hydration-safe sizing: reads dimensions (evidence: `packages/core/src/responsive/useBreakpoint.ts`)
- Search view → Focus management: traps focus (evidence: `packages/components/src/search-view/SearchView.tsx`)
- Search view → Portal rendering: renders through (evidence: `packages/components/src/search-view/SearchView.tsx`)
- Search view → Inputs and actions: renders buttons (evidence: `packages/components/src/search-view/SearchView.tsx`)
- App developer → Icon resolver adapters: configures resolver (evidence: `README.md`)
- Icon resolver adapters → Resolver builder: uses builder (evidence: `packages/icons/src/internal/buildResolver.ts`)
- App developer → CLI command router: runs CLI (evidence: `packages/cli/src/index.ts`)
- CLI command router → Create project: dispatches create (evidence: `packages/cli/src/index.ts`)
- CLI command router → Initialize project: dispatches init (evidence: `packages/cli/src/index.ts`)
- CLI command router → Add components: dispatches add (evidence: `packages/cli/src/index.ts`)
- CLI command router → Update components: dispatches update (evidence: `packages/cli/src/index.ts`)
- CLI command router → Upgrade dependencies: dispatches upgrade (evidence: `packages/cli/src/index.ts`)
- CLI command router → List and diagnose: dispatches checks (evidence: `packages/cli/src/index.ts`)
- Create project → Expo starter templates: scaffolds from (evidence: `README.md`)
- Initialize project → Component registry: reads version (evidence: `packages/cli/src/commands/init.ts`)
- Add components → Component registry: reads entries (evidence: `packages/cli/src/commands/add.ts`)
- Add components → Dependency resolver: resolves dependencies (evidence: `packages/cli/src/commands/add.ts`)
- Add components → Source installer: installs files (evidence: `packages/cli/src/commands/add.ts`)
- Update components → Component registry: reads entries (evidence: `packages/cli/src/commands/update.ts`)
- Upgrade dependencies → Update components: optionally updates files (evidence: `packages/cli/src/commands/upgrade.ts`)
