Back to .md Directory

OneCoach UI - Agent Guide

Documents the structure, packages, and development conventions for a React/React Native UI component library built with Radix UI and Tailwind CSS.

May 2, 2026
0 downloads
0 views
ai agent
View source

What this file does

Documents the structure, packages, and development conventions for a React/React Native UI component library built with Radix UI and Tailwind CSS.

When to use it

  • Onboarding to a monorepo with a shared UI package
  • Setting up a component library with Radix UI and Tailwind
  • Establishing design token and styling conventions for a team
  • Learning the package layout of an existing OneCoach project

Assumes this stack

React 19React NativeTypeScriptTailwind CSS v4Radix UIFramer Motion

OneCoach UI - Agent Guide

Meta: UI component library for OneCoach. React/React Native compatible using Radix UI, Tailwind CSS, and design tokens.

Quick Reference

AttributeValue
Monoreposubmodules/onecoach-ui
StylingTailwind CSS v4
ComponentsRadix UI primitives
IconsLucide React
AnimationsFramer Motion

Package Structure

submodules/onecoach-ui/
├── packages/
│   ├── ui/                 # @onecoach/ui - Component library
│   ├── hooks/              # @onecoach/hooks - Shared React hooks
│   ├── design-system/      # Design system integration
│   └── lib-design-system/  # @onecoach/lib-design-system - Tokens
├── package.json
└── pnpm-workspace.yaml

Key Packages

@onecoach/ui (packages/ui)

Main component library:

  • Components in src/components/
  • Entry point: src/index.ts
  • Radix UI + Tailwind + cva (class-variance-authority)

@onecoach/hooks (packages/hooks)

Shared React hooks:

  • Form handling
  • Feature flags
  • UI state management

@onecoach/lib-design-system (packages/lib-design-system)

Design tokens & theme:

  • Colors, spacing, typography
  • Animation utilities
  • Theme configuration

Development Guidelines

Styling

// ✅ Use design tokens
className = 'bg-primary text-primary-foreground';

// ❌ Never hardcode values
className = 'bg-[#1a1a1a]';
  • Always use Tailwind utility classes
  • Prefer tokens from @onecoach/lib-design-system
  • Support dark mode with dark: variants

Creating Components

  1. Location: packages/ui/src/components/
  2. Use Radix UI for accessible primitives
  3. Use cva for variants:
import { cva } from 'class-variance-authority';

const buttonVariants = cva('inline-flex items-center justify-center rounded-md', {
  variants: {
    variant: {
      default: 'bg-primary text-primary-foreground',
      outline: 'border border-input bg-background',
    },
    size: {
      default: 'h-10 px-4 py-2',
      sm: 'h-9 px-3',
      lg: 'h-11 px-8',
    },
  },
  defaultVariants: {
    variant: 'default',
    size: 'default',
  },
});

Navigation Guide

TaskLocation
Add componentpackages/ui/src/components/
Add hookpackages/hooks/
Modify tokenspackages/lib-design-system/
Check exportspackages/ui/src/index.ts

Technology Stack

LayerTechnology
FrameworkReact 19 / React Native
LanguageTypeScript
StylingTailwind CSS v4
IconsLucide React
MotionFramer Motion
BuildTurborepo / pnpm workspaces

What's inside

1 quick reference table, 1 directory tree, 4 package descriptions, 2 code examples, 1 navigation table, 1 technology stack table

Change this for your project

  • Replace submodules/onecoach-ui with your monorepo path
  • Replace @onecoach/ui, @onecoach/hooks, @onecoach/lib-design-system with your package names
  • Replace OneCoach in the meta description with your project name

Where it goes

Save as AGENTS.md in your repository root. Read by Codex, Cursor and other agents that follow the AGENTS.md convention.

Worth borrowing

  • Using cva (class-variance-authority) for component variant definitions
  • Separating design tokens into a dedicated package for cross-platform consistency

Related Documents