Developer guide

Tailwind component library with editable React source

A Tailwind component library packages reusable interface behavior with utility-class styling that can be inspected beside the JSX. This guide explains how Spectrum UI components use local Tailwind CSS source and where that approach fits forms, cards, navigation, status, and layout work.

Because the utilities live in the copied file, teams can replace spacing, color, typography, breakpoints, and state styles without waiting for a theme API. Component pages identify additional packages or shadcn/ui primitives when the source requires them.

What Tailwind Component Library means

Tailwind CSS supplies low-level utility classes; a component library supplies repeatable structure, states, and interaction behavior. Combining them makes the styling contract visible at the point where the component renders.

This approach is most useful when a team already has Tailwind tokens and wants to keep component changes inside normal code review. It still requires testing responsive layouts, focus states, contrast, and any class changes introduced by a Tailwind upgrade.

When to use these patterns

01

Your product already uses Tailwind CSS

Local utilities let the component inherit existing spacing, color, typography, and breakpoint conventions.

02

You want styling changes in code review

Utility changes remain beside the JSX, making the visual diff and affected states easier to inspect together.

03

A fixed theme API is too limiting

Edit the source directly when a component needs structural changes beyond colors or variant names.

Adapt a button with local Tailwind utilities

The shadcn/ui button remains composable while route-specific spacing and focus treatment stay at the call site.

pnpm dlx shadcn@latest add button
SaveActions.tsx
import { Button } from '@/components/ui/button';

export function SaveActions() {
  return (
    <div className="flex flex-wrap items-center gap-3">
      <Button className="rounded-full px-5">Save changes</Button>
      <Button variant="outline" className="rounded-full">
        Cancel
      </Button>
    </div>
  );
}

Tailwind Component Library questions

The documented components expose their source and Tailwind utility classes. Install any declared global styles or dependencies shown by the specific component.