UI Component Library
Overview
How the shared UI tokens, Uniwind setup, and cross-platform components keep VibeFast consistent.
VibeFast's UI library spans the Expo/native app and the Next.js web app. Each side uses its own toolkit (Uniwind/Tailwind on mobile, Tailwind-cva on web), but they run off the same design tokens and shared component primitives so you get a consistent look and feel regardless of the platform.
Design tokens & theming
- Color tokens:
apps/native/src/components/ui/colors.jsis the single source for palettes such asprimary,accent,background, andforeground. Uniwind maps those tokens into semanticbg-*/text-*utilities, and the Next.js styles import the same palette via thethemeobject insideapps/web/styles/globals.cssorapps/web/components/ui/helpers (seecn+class-variance-authoritypatterns). - Spacing & typography: The
useThemeConfighook (apps/native/src/lib/use-theme-config.tsx) exposes typography, radii, and spacing values that you can pass into RN components or use in Next.js classes via thethemeobject fromnext-themes. - Dark mode: Both apps read the same token names, so toggling dark mode (exported via
ThemeProviderandnext-themeson the web) yields identical colors forbg-primary/text-foregroundacross devices.
Uniwind + Tailwind setup
- Mobile components rely on
apps/native/tailwind.config.js, which loads the color tokens and custom utilities. You simply useclassName="bg-primary-500 px-4 py-3"and Uniwind resolves the values. - Web components use
class-variance-authority (cva)helpers (seeapps/web/components/ui/button.tsx) plus thecnutility (apps/web/lib/utils.ts). Utility classes likebg-primary text-primary-foregroundmirror the mobile names, so design updates flow both places.
Component organization
- Core components: Located under
apps/native/src/components/uiandapps/web/components/ui. They include buttons, inputs, cards, floaters, dialogs, toasts, etc. Both folders expose variant-friendly APIs (size/variant props,asChild, etc.). - Advanced components: More complex screens live under
apps/native/src/components/advanced-ui(steppers, multi-column layouts) andapps/web/components(dashboards, layouts, admin widgets) and reuse the same primitives. - Primitive helpers: Shared helpers such as
Button/Input/Selecton Native andButton/Inputon web follow the same props and semantics, so migrating a card from mobile to web mostly means reusing tokens rather than rewriting styles.
Found an issue or bug in the docs?
Help me improve! If you spot any errors, typos, or have suggestions, please let me know.
Reach out on X/Twitter @zafarbuildzz