Pitsi UI
  • Home
  • Docs
1
1
Sections
  • Get Started
  • Components
  • Animations
  • MCP Server
  • Changelog
Get Started
  • Installation
  • CLI
  • llms.txt
Components
  • Accordion
  • Alert Dialog
  • Alert
  • Aspect Ratio
  • Avatar
  • Badge
  • Breadcrumb
  • Button Group
  • Button
  • Card
  • Carousel
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Container
  • Context Menu
  • Data Table
  • Dialog
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Flex
  • Form
  • Grid
  • Hero Button
  • Hover Card
  • Input Group
  • Input OTP
  • Input
  • Item
  • Kbd
  • Label
  • Menubar
  • Native Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Resizable
  • Responsive
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spacer
  • Spinner
  • Squircle
  • Switch
  • Table
  • Tabs
  • Textarea
  • Theme Toggle
  • Toggle Group
  • Toggle
  • Tooltip
  • Typography
  • Unicorn Wrapper
Animations
  • Background Image Parallax
  • Card Swipe Carousel
  • Cards Parallax
  • Parallax Scroll
  • Perspective Carousel
  • Perspective Section Transition
  • Scroll Expand
  • Scroll Fade
  • Scroll Scale
  • Slide Down
  • Slide Up
  • Smooth Parallax Scroll
  • Smooth Scroll
  • Sticky Footer
  • Text Along Path
  • Text Gradient Opacity
  • Text Parallax
  • Transforms 3d
  • Zoom Parallax

Flex

PreviousNext

A flexbox layout component with variant-based styling and responsive props.

Powered by
shadcn/ui
"use client"

import Flex from "@/components/ui/flex"

export function FlexDemo() {
  return (
    <Flex justify="center" align="center" gap="lg" className="w-full p-8">
      <div className="bg-card border-border text-foreground flex size-16 items-center justify-center rounded-full border shadow-md">
        <span className="text-xl font-semibold">1</span>
      </div>
      <div className="bg-card border-border text-foreground flex size-16 items-center justify-center rounded-full border shadow-md">
        <span className="text-xl font-semibold">2</span>
      </div>
      <div className="bg-card border-border text-foreground flex size-16 items-center justify-center rounded-full border shadow-md">
        <span className="text-xl font-semibold">3</span>
      </div>
    </Flex>
  )
}

Installation

pnpm dlx pitsi@latest add flex

Usage

import Flex from "@/components/ui/flex"
<Flex direction="row" gap="md" align="center" justify="between">
  <div>Start</div>
  <div>End</div>
</Flex>

Examples

Column Layout

<Flex direction="col" gap="md">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</Flex>

Centered Content

<Flex justify="center" align="center" className="h-64">
  <div>Centered Content</div>
</Flex>

Responsive Layout

<Flex direction="row" directionMobile="col" gap="lg" gapMobile="sm">
  <div>Responsive Item 1</div>
  <div>Responsive Item 2</div>
</Flex>

Space Between

<Flex justify="between" align="center">
  <span>Left</span>
  <span>Right</span>
</Flex>

Props

Flex

PropTypeDefaultDescription
asReact.ElementType"div"The element to render as
direction"row" | "row-reverse" | "col" | "col-reverse""row"Flex direction
align"start" | "center" | "end" | "stretch" | "baseline""start"Align items
justify"start" | "center" | "end" | "between" | "around" | "evenly""start"Justify content
wrap"wrap" | "nowrap" | "wrap-reverse""nowrap"Flex wrap
gap"xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "8xl" | "9xl"-Gap between items
directionMobiledirection-Direction on mobile
alignMobilealign-Align on mobile
justifyMobilejustify-Justify on mobile
wrapMobilewrap-Wrap on mobile
gapMobilegap-Gap on mobile
classNamestring-Additional classes

Notes

  • The component uses the use-mobile hook to detect mobile screens and apply mobile-specific props.
  • All responsive props (ending with Mobile) will only apply when the viewport is considered mobile.
  • The component is polymorphic and can be rendered as any HTML element using the as prop.
FieldForm

On This Page

InstallationUsageExamplesColumn LayoutCentered ContentResponsive LayoutSpace BetweenPropsFlexNotes

© 2025 pitsi/ui. All rights reserved.

Sign In