This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
yarn
# Development — watch src/ and sync changes to all apps
yarn dev # all mappers
yarn dev:kitchen-sink # kitchen-sink mapper only
yarn dev:website # website mapper only
yarn dev:starter-kits # starter-kits mapper only
# One-time sync (no watching)
yarn sync # all mappers
yarn sync:kitchen-sink
yarn sync:website
yarn sync:starter-kits
# Local package development (uses yalc; requires `npm install -g yalc`)
yarn link:create # build + publish gluestack-utils & gluestack-core to yalc, start watch
yarn link:apps # link yalc packages into all apps
yarn link:apps-website # link into website app only
yarn link:apps-kitchen-sink # link into kitchen-sink app only
yarn unlink:apps # remove yalc links from all apps, clean up
# Build all packages
yarn build # runs `yarn workspaces run build`
# Formatting
yarn format # prettier --write
yarn format:check # prettier --check
# Create a new component (scaffolding script)
yarn create:component
# Changesets (for publishing packages)
yarn changeset # create a changeset
yarn changeset:version # bump versions
yarn release # publishTo run an app locally after syncing: cd apps/kitchen-sink && yarn dev or cd apps/website && yarn dev.
This is a source-to-destination repo. src/ is the single source of truth. Mapper scripts in scripts/ copy files from src/ into apps/ destinations. Generated files under apps/*/components/ui/ are gitignored — never edit them directly. Always edit in src/ and let the mappers sync.
src/
├── components/ui/ # All UI components (Button, Input, Modal, etc.)
├── docs-components/ # Documentation-specific components (website only)
├── docs/ # Component docs/examples (website only)
└── sidebar.json # Documentation sidebar config (website only)
apps/
├── website/ # gluestack.io documentation site (Next.js)
├── kitchen-sink/ # Component showcase & testing (Expo)
├── starter-kit-next/ # Next.js starter template
└── starter-kit-expo/ # Expo starter template
Mappers expose two hooks: component(componentName, event) for files within components/ui/ and nonComponent(filePath) for everything else (docs, sidebar, docs-components). The dev script (scripts/dev.ts) watches src/ with chokidar, debounces events (1s), and dispatches to active mappers.
| Package | Purpose |
|---|---|
gluestack-ui (published as gluestack-ui) |
CLI for gluestack-ui init, add, upgrade commands. Contains templates for Next.js, Expo, React Native CLI project scaffolding. |
create-gluestack |
CLI for create-gluestack (project initializer). |
@gluestack-ui/core |
Component creator functions and aria hooks. Each component has a factory (createX) that takes primitive components (Pressable, View, Text, etc.) and returns a compound component with sub-components (Root, Text, Icon, Spinner, etc.). Deep sub-path exports like @gluestack-ui/core/button/creator. |
@gluestack-ui/utils |
Shared hooks (useDisclose, useMediaQuery, useControllableState, etc.), aria utilities, NativeWind helpers (tva, withStyleContext, useStyleContext). Deep sub-path exports like @gluestack-ui/utils/nativewind-utils. |
@gluestack/ui-next-adapter |
Next.js adapter that enables React Native Web components in RSC environments. |
Each component follows a two-layer pattern:
-
packages/gluestack-core/src/<component>/creator/— ThecreateXfactory function. It receives generic primitive components (Root, Text, Group, Spinner, Icon) and composes them into a compound component with sub-components. This layer has no styling — pure logic and accessibility. -
packages/gluestack-core/src/<component>/aria/— Accessibility hooks using React Aria for keyboard navigation, focus management, and screen reader support. -
src/components/ui/<component>/index.tsx— The copy-pasteable component. CallscreateX()with React Native primitives (Pressable, View, Text), applies styling viatva()(tailwind-variants), and useswithStyleContextfor style inheritance. Components are'use client'and import fromreact-nativedirectly (not from NativeWind wrappers).
src/components/ui/button/
├── index.tsx # Styled Button component (copy-pasteable)
├── dependencies.json # External dependencies used by this component
├── docs/index.mdx # Documentation page
└── examples/ # Usage examples (meta.json + template.handlebars)
yarn create:componentscaffolds insrc/components/ui/- If the component needs core logic: add a creator in
packages/gluestack-core/src/<name>/creator/ - If it needs a11y: add aria hooks in
packages/gluestack-core/src/<name>/aria/ - Add examples in
src/components/ui/<name>/examples/ - Add docs in
src/components/ui/<name>/docs/ - Update
src/sidebar.jsonto list the component in navigation - If new dependencies are needed, update
packages/gluestack-ui/src/dependencies.tsfor CLI-based installs
- Changesets manage versioning across all packages. PRs should include a changeset via
yarn changeset. - CI workflows:
next-latest.ymlandexpo-latest.ymlrun on PRs tomain.publish-production.ymlhandles npm publishes. - There's a preview publish system (
preview-publish.yml,cleanup-preview.yml) for pre-release testing.