WorkRunner Documentation

Styling

Use Tailwind CSS utility classes. No inline styles, CSS modules, or external stylesheets.

Basic Layout

// Standard Construct wrapper
<div className="min-h-screen bg-background p-4 sm:p-6">
  <Card className="mx-auto max-w-md">
    {/* Content */}
  </Card>
</div>

// For wider Constructs
<div className="min-h-screen bg-background p-4 sm:p-6">
  <Card className="mx-auto max-w-2xl">
    {/* Content */}
  </Card>
</div>

Responsive Design

Always design mobile-first and add breakpoints for larger screens:

PrefixMin WidthUsage
none0pxMobile (default)
sm:640pxLarge phones
md:768pxTablets
lg:1024pxDesktops
// Responsive padding
<div className="p-4 sm:p-6 lg:p-8">

// Responsive grid
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">

// Responsive text
<h1 className="text-xl sm:text-2xl lg:text-3xl">

// Hide on mobile
<div className="hidden sm:block">

// Show only on mobile
<div className="block sm:hidden">

Spacing

Use consistent spacing with Tailwind's spacing scale:

// Vertical spacing between elements
<div className="space-y-4">
  <Element />
  <Element />
</div>

// Horizontal spacing
<div className="flex gap-4">
  <Element />
  <Element />
</div>

// Common patterns
<CardContent className="space-y-4">     // 16px between items
<CardContent className="space-y-6">     // 24px between sections

// Padding
<div className="p-4">                    // 16px all sides
<div className="px-4 py-2">              // 16px horizontal, 8px vertical

Dark Mode

Constructs must support dark mode. Use CSS variables or dark: variants:

// Option 1: CSS Variables (recommended)
// These automatically adapt to the theme
<div className="bg-background text-foreground">
<div className="border-border">
<p className="text-muted-foreground">

// Available CSS variable colors:
// bg-background      - Main background
// bg-card            - Card background
// bg-muted           - Muted background
// bg-accent          - Accent background
// bg-primary         - Primary color
// bg-destructive     - Error/delete color

// text-foreground    - Main text
// text-muted-foreground - Secondary text
// text-primary       - Primary color text

// border-border      - Default borders

// Option 2: dark: prefix
<div className="bg-white dark:bg-zinc-900">
<p className="text-gray-900 dark:text-gray-100">

Prefer CSS Variables

CSS variables like bg-background automatically adapt to the user's theme preference without extra code.

Common Patterns

List Items

<div className="flex items-center gap-3 rounded-lg border p-3">
  <Checkbox />
  <span className="flex-1">{text}</span>
  <Button variant="ghost" size="icon">
    <Trash2 className="h-4 w-4" />
  </Button>
</div>

Form Groups

<div className="space-y-2">
  <Label htmlFor="name">Name</Label>
  <Input id="name" />
</div>

Action Bar

<div className="flex gap-2">
  <Input placeholder="Add item..." className="flex-1" />
  <Button>
    <Plus className="h-4 w-4" />
  </Button>
</div>

Empty State

{items.length === 0 && (
  <div className="py-12 text-center">
    <Package className="mx-auto h-12 w-12 text-muted-foreground" />
    <p className="mt-4 text-sm text-muted-foreground">
      No items yet. Add one above!
    </p>
  </div>
)}

Stats Grid

<div className="grid gap-4 sm:grid-cols-3">
  <Card>
    <CardContent className="pt-6">
      <p className="text-2xl font-bold">{total}</p>
      <p className="text-sm text-muted-foreground">Total Items</p>
    </CardContent>
  </Card>
  {/* More stat cards */}
</div>

What NOT to Do

No inline styles

style={{ padding: "20px" }}

No CSS modules

import styles from "./App.module.css"

No external CSS

import "./styles.css"

No fixed widths

className="w-[500px]" → use max-w-md

No styled-components

const Button = styled.button``