FLOWDocs

Typography

Geist font families और typographic primitives।

Flow UI दो font families ship करता है — Geist Sans और Geist Mono — और सबसे आम text roles को wrap करने वाले typographic React components का एक छोटा set।

Fonts

दोनों self-hosted हैं — woff2 files package में vendor की गई हैं (src/styles/fonts/) और fonts.css द्वारा register होती हैं, इसलिए consumers इन्हें बिना किसी external font request के सीधे bundle कर लेते हैं। font-display: swap (FOUT, FOIT नहीं) के साथ load होते हैं ताकि text हमेशा तुरंत paint हो।

Geist Sans

Variable font, weights 100–900, italic axis के साथ। Monospace role को छोड़कर हर चीज़ के लिए use करें।

font-family: var(--font-sans);

Geist Mono

Variable, weights 100–900, italic के साथ। Code, keyboard keys, console output, जहाँ character alignment मायने रखता हो — वहाँ use करें।

font-family: var(--font-mono);

Text size scale

हर size एक CSS variable पर रहता है। Tailwind utilities text-xs से text-9xl तक इन tokens पर map होती हैं।

पूरी list के लिए Tokens → Size scale देखें।

Components

@flow-industries/ui/components/typography से import करें। Exports: Title, Subtitle, Overline, Paragraph, Mono।

GitHub पर source देखें →

उपयोग:

import { Title, Subtitle, Overline, Paragraph, Mono } from "@flow-industries/ui/components/typography";

<Title size="lg">Welcome to Flow</Title>
<Subtitle size="lg">A decentralized platform.</Subtitle>
<Overline variant="brand">Now shipping</Overline>
<Paragraph>Some body copy that goes on for several words and lines.</Paragraph>
<Mono>bun add @flow-industries/ui</Mono>

Title sizes HTML tags पर map होते हैं: sm → <h3>, default → <h2>, md → <h2>, lg → <h1> — या heading tag सीधे सेट करने के लिए level (1–6) दें (<h1>–<h6>), जिससे visual size वही रहे और document outline सही बनी रहे। Subtitle भी यही चार sizes देता है। Overline default और brand variants support करता है। Paragraph size लेता है — "xs" | "sm" | "default" | "lg" — और इसका default "sm" है, "default" नहीं।

Source:

components/ui/typography.tsx
import { cn } from "../../utils/cn";

const titleStyles = {
  sm: "text-sm font-semibold",
  default: "text-base font-bold tracking-tighter",
  md: "text-2xl font-bold tracking-tighter",
  lg: "text-3xl font-bold tracking-tighter",
} as const;

const titleTags = { sm: "h3", default: "h2", md: "h2", lg: "h1" } as const;

const headingTags = {
  1: "h1",
  2: "h2",
  3: "h3",
  4: "h4",
  5: "h5",
  6: "h6",
} as const;

function Title({
  className,
  size = "default",
  level,
  ...props
}: React.ComponentProps<"h1"> & {
  size?: "sm" | "default" | "md" | "lg";
  level?: 1 | 2 | 3 | 4 | 5 | 6;
}) {
  const Tag = level ? headingTags[level] : titleTags[size];
  return (
    <Tag
      data-slot="title"
      className={cn(titleStyles[size], className)}
      {...props}
    />
  );
}

const subtitleStyles = {
  sm: "text-xs font-medium text-muted-foreground",
  default: "text-sm font-medium text-muted-foreground",
  md: "text-base font-medium text-muted-foreground",
  lg: "text-lg font-medium text-muted-foreground",
} as const;

function Subtitle({
  className,
  size = "default",
  ...props
}: React.ComponentProps<"p"> & { size?: "sm" | "default" | "md" | "lg" }) {
  return (
    <p
      data-slot="subtitle"
      className={cn(subtitleStyles[size], className)}
      {...props}
    />
  );
}

function Overline({
  className,
  variant = "default",
  ...props
}: React.ComponentProps<"span"> & { variant?: "default" | "brand" }) {
  return (
    <span
      data-slot="overline"
      className={cn(
        "text-sm font-[550] tracking-wide",
        variant === "brand" ? "text-brand-text" : "text-muted-foreground",
        className,
      )}
      {...props}
    />
  );
}

const paragraphVariants = {
  xs: "text-xs",
  sm: "text-sm",
  default: "text-base",
  lg: "text-lg",
} as const;

function Paragraph({
  className,
  size = "sm",
  ...props
}: React.ComponentProps<"p"> & { size?: "xs" | "sm" | "default" | "lg" }) {
  return (
    <p
      data-slot="paragraph"
      className={cn(
        "font-[450] leading-[150%] tracking-wide text-foreground/80",
        paragraphVariants[size],
        className,
      )}
      {...props}
    />
  );
}

function Mono({ className, ...props }: React.ComponentProps<"code">) {
  return (
    <code
      data-slot="mono"
      className={cn(
        "text-sm font-mono tracking-normal text-muted-foreground",
        className,
      )}
      {...props}
    />
  );
}

export { Mono, Overline, Paragraph, Subtitle, Title };

सीधे Tailwind का उपयोग

आपको classes सीधे लिखने से कुछ नहीं रोकता — सभी Flow components className accept करते हैं और cn() से merge करते हैं:

<h1 className="font-sans text-6xl font-bold tracking-tight">Hello</h1>
<code className="font-mono text-sm">example</code>

जब design-system-approved default चाहिए हो तो components use करें; जब कुछ bespoke चाहिए हो तो raw classes use करें।

On this page