FLOWDocs

Installation

Package install करें और Tailwind v4 wire up करें।

Flow UI React 19 + Tailwind v4 पर चलता है। Install करने से पहले दोनों set up करें।

Install

bun add @flow-industries/ui
bun add -D tailwindcss @tailwindcss/vite

Peer dependencies:

  • react ≥ 19
  • react-dom ≥ 19
  • tailwindcss ≥ 4

Vite config

Vite में Tailwind plugin जोड़ें:

import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
  plugins: [tailwindcss(), /* ...other plugins */],
});

CSS imports

एक stylesheet बनाएं (जैसे app.css) और Flow UI की तीनों stylesheets को ठीक इसी order में import करें, इसके बाद एक @source directive जोड़ें ताकि Tailwind Flow UI की TSX scan करे:

@import "@flow-industries/ui/styles/tokens.css";
@import "@flow-industries/ui/styles/base.css";
@import "@flow-industries/ui/styles/fonts.css";

@source "../../node_modules/@flow-industries/ui/src";

इस stylesheet को अपने app entry से import करें:

import "./app.css";

Order क्यों मायने रखता है

  1. tokens.css उस @theme block को define करता है जो हर Flow CSS variable declare करता है। Tailwind को ये parse time पर चाहिए होते हैं।
  2. base.css Tailwind @import + base layer resets apply करता है।
  3. fonts.css Geist के लिए @font-face rules register करता है। base.css के बाद इसे import करने से fonts baseline typography reset पर हावी होते हैं।

इस order को बदलने से अक्सर invisible bugs होते हैं — गलत fonts, टूटा dark mode, गायब token values।

Source directive

@source line load-bearing है। Tailwind v4 सिर्फ उन class names के लिए utility classes generate करता है जिन्हें वह देख पाता है; Flow UI की TSX files node_modules में रहती हैं, जिन्हें Tailwind default से skip करता है। @source को उन पर point करने से यह ठीक हो जाता है।

Path को adjust करें ताकि वह CSS file की location से resolve हो। Hoisted deps वाले monorepo में:

@source "../../../node_modules/@flow-industries/ui/src";

Local node_modules में deps के साथ single-package app में:

@source "./node_modules/@flow-industries/ui/src";

Components import करना

import { Button } from "@flow-industries/ui/components/button";
import { Dialog, DialogTrigger, DialogContent } from "@flow-industries/ui/components/dialog";
import { cn } from "@flow-industries/ui";
import { Logo, Logomark } from "@flow-industries/ui/logo";
import { XIcon } from "@flow-industries/ui/icons";

हर component का अपना subpath @flow-industries/ui/components/* के अंतर्गत है ताकि imports tree-shake हों। अगर single import site पसंद है, तो @flow-industries/ui/components barrel ज़्यादातर components को re-export करता है, पर कुछ — typography, combobox, native-select, validated-input, animated-icons, color-swatch, direction — सिर्फ़ अपने per-file subpath के ज़रिए ही पहुँच में आते हैं।

Dark mode

Flow UI दोनों palettes ship करता है। <html> पर class="dark" जोड़कर या हटाकर toggle करें:

document.documentElement.classList.toggle("dark");

Custom palettes के लिए Theming देखें।

आगे

On this page