This workspace contains the core UI components for the application, built using React, React Aria Components, and styled with Tailwind CSS and tailwind-variants. Storybook is used for component development, testing, and documentation.
The main goal of this package is to provide a consistent, accessible, and reusable set of UI components that can be used across different parts of the application, primarily the main web application (apps/app).
src/components/: Contains the individual React components (e.g.,Button.tsx,Dialog.tsx,TextField.tsx). Each component is typically exported directly.src/lib/: Contains utility functions, specificallysrc/lib/utils.tswhich exportscn(clsx + tailwind-merge) and re-exportstailwind-variantsfor styling utilities.src/*.ts: Files likeRAC.ts,RAH.ts,RAS.tsre-export symbols fromreact-aria-components,react-aria, andreact-statelyrespectively.useGesture.tsre-exports theuseGesturehook from@use-gesture/react.tailwind.shared.ts: Shared Tailwind configuration presets or plugins used internally by this package (e.g., for Storybook), and consumed by other workspaces.tailwind.styles.scss: Base styles or global CSS definitions related to Tailwind.tailwind.utils.mjs: Tailwind utility functions or helpers.storybook/: Configuration and stories for Storybook.
Components and utilities are exported via the exports map in package.json.
- React: UI library.
- React Aria Components: Library for building accessible UI components.
- Tailwind CSS: Utility-first CSS framework.
- tailwind-variants: Library for creating type-safe component variants with Tailwind.
- Storybook: UI component development environment.
- Lucide Icons: Icon library.
- Clsx / tailwind-merge: Utilities for managing CSS classes.
Depends On:
-
@op/core: For shared constants, specificallycommonColorsused intailwind.shared.ts. -
@op/typescript-config(Dev): Used for TypeScript configuration during development.
Depended On By:
apps/api: Listed as a dependency, but doesn't appear to actively import or use components from this package.apps/app: The primary consumer of the UI components defined here.
- Run
pnpm devto start the Storybook server (usually on port 3600). - Run
pnpm typecheckto type-check the code. - Run
pnpm buildto create a production build of Storybook.
This package is configured to use Intent UI, a shadcn-compatible component library built on React Aria Components. Intent UI components can be added via the shadcn CLI.
From the packages/ui directory:
pnpm dlx shadcn@latest add @intentui/<component-name>For example:
pnpm dlx shadcn@latest add @intentui/button
pnpm dlx shadcn@latest add @intentui/dialog
pnpm dlx shadcn@latest add @intentui/comboboxComponents are installed to src/components/ui/ by default.
After adding a component:
-
Use existing components: Where possible, replace Intent UI dependencies with existing
@op/uicomponents. For example, replace the Intent UI checkbox import with@/components/Checkbox. -
Export the component: Add an export to
package.json:{ "exports": { "./ui/<component>": "./src/components/ui/<component>.tsx" } } -
Add a Storybook story: Create a story in
stories/<Component>.stories.tsx. -
Run typecheck: Verify the component compiles with
pnpm typecheck.
Intent UI components use CSS variables that are mapped to @op/styles tokens in packages/styles/intent-ui-theme.css. The theme provides:
- Colors:
--primary,--secondary,--danger, etc. mapped to teal/neutral/red tokens - Border color: Default border color set via
var(--border)on all elements - Border radius: Calc-based system using
--radius-lgas the base (0.375rem)
To customize colors, edit the mappings in intent-ui-theme.css.
Intent UI components may use these utilities from this package:
cx()fromlib/primitive: Composes Tailwind classes with React Aria render propsuseMediaQuery()fromhooks/use-media-query: Responsive breakpoint hook
Visit intentui.com/docs/components to see all available components.