A modern, accessible form component library built on the U.S. Web Design System (USWDS) standards with React integration.
This project provides a comprehensive form system that combines USWDS design principles with React components. It offers both pre-compiled CSS for immediate use and optional Tailwind CSS integration for advanced customization.
- 🎨 USWDS-compliant components - Follows U.S. Web Design System standards
- ♿ Accessibility-first - Built with WCAG 2.1 AA compliance in mind
- 📦 Flexible distribution - Works with or without Tailwind CSS
- 🔧 Type-safe - Full TypeScript support
- 🚀 Performance optimized - Tree-shakeable with minimal bundle impact
- 🧩 Modular architecture - Use only what you need
Package | Description | Status |
---|---|---|
@acme/ui |
Core React component library with Tailwind CSS | ✅ Implemented |
@acme/eslint-config |
Shared ESLint configuration | ✅ Implemented |
@acme/tailwind-config |
Shared Tailwind CSS configuration | ✅ Implemented |
@acme/typescript-config |
Shared TypeScript configuration | ✅ Implemented |
@acme/form |
Advanced form components and validation | 🚧 Planned |
@acme/form-renderer |
Dynamic form rendering engine | 🚧 Planned |
@acme/uswds-tailwind-preset |
USWDS Tailwind preset | 🚧 Planned |
# Using npm
npm install @acme/ui
# Using yarn
yarn add @acme/ui
# Using pnpm
pnpm add @acme/ui
Note: Packages are not yet published to npm. This shows the intended installation method once published.
The @acme/ui
package provides React components styled with Tailwind CSS and Class Variance Authority (CVA):
// Import components
import { Button, Card, CardHeader, CardTitle, CardContent, Code } from "@acme/ui";
function MyApp() {
return (
<Card>
<CardHeader>
<CardTitle>Example Card</CardTitle>
</CardHeader>
<CardContent>
<Button variant="default" size="md">
Click me
</Button>
<Code>console.log('Hello')</Code>
</CardContent>
</Card>
);
}
- Button: Multiple variants (default, destructive, outline, secondary, ghost, link) and sizes (sm, default, lg, icon)
- Card: Compound component with CardHeader, CardTitle, CardDescription, CardContent, CardFooter
- Code: Inline code display component
This project includes Tailwind CSS integration for custom styling and rapid UI development.
- Install required dependencies:
pnpm add -D tailwindcss postcss autoprefixer
- Create or update your
tailwind.config.js
:
// tailwind.config.js
const sharedConfig = require("@acme/tailwind-config");
module.exports = {
presets: [sharedConfig],
content: [
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
// Include UI package components
"../../packages/ui/src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {
// Your custom theme extensions
},
},
};
- Add Tailwind directives to your CSS:
/* globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
- Configure PostCSS:
// postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
The @acme/tailwind-config
package provides a consistent design system across all applications with:
- Custom color palettes (primary and secondary scales)
- Geist font family configuration
- Responsive breakpoints
- Dark mode support
See the Tailwind configuration documentation for more details on available utilities and customization options.
This monorepo uses Turborepo for efficient builds and pnpm for package management.
- Node.js >= 22
- pnpm >= 9
# Clone the repository
git clone https://github.com/acme/form-system-uswds.git
cd form-system-uswds
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Start development server
pnpm dev
# Run tests
pnpm test
# Run linting
pnpm lint
# Run type checking
pnpm check-types
# Start Storybook for component development
cd packages/ui
pnpm dev # Without auto-opening browser
pnpm dev:open # With auto-opening browser
# Build Storybook static site
pnpm build-storybook
# Run tests
pnpm test # Run all tests (lint, type-check, build, storybook tests)
# Run Storybook tests specifically
pnpm test:storybook # Run tests with running Storybook
pnpm test:storybook:ci # Run tests in CI mode (builds and serves Storybook)
.
├── apps/
│ ├── docs/ # Documentation site (Next.js)
│ └── web/ # Component showcase (Next.js)
├── packages/
│ ├── ui/ # Core component library
│ │ ├── src/
│ │ │ ├── components/ # React components
│ │ │ │ ├── button/
│ │ │ │ ├── card/
│ │ │ │ └── code/
│ │ │ ├── foundations/ # Typography stories
│ │ │ ├── lib/ # Utilities
│ │ │ └── styles/ # Global CSS
│ │ └── .storybook/ # Storybook configuration
│ ├── eslint-config/ # Shared ESLint rules
│ ├── tailwind-config/ # Shared Tailwind configuration
│ └── typescript-config/ # Shared TypeScript configs
└── turbo.json # Turborepo configuration
We take accessibility seriously. All components are tested against:
- Screen readers: NVDA, JAWS, and VoiceOver
- Keyboard navigation: Full keyboard support with proper focus management
- Color contrast: WCAG 2.1 AA compliant
- ARIA attributes: Semantic HTML with appropriate ARIA labels
- axe-core: Zero critical violations on all components
- Lighthouse: Accessibility score ≥ 95
- Keyboard testing: Full form submission without mouse
- Focus management: Error summary with proper focus sequencing
All components include:
- Interaction tests: Using Storybook play functions with Testing Library
- Accessibility tests: Automated axe-core checks via @storybook/addon-a11y
- Visual testing: Storybook stories for all component variants
- Test runner: Playwright-based test runner for CI/CD integration
- Chrome (last 2 versions)
- Firefox (last 2 versions)
- Safari (last 2 versions)
- Edge (last 2 versions)
We use Semantic Versioning. For the versions available, see the releases.
The @acme/ui
and @acme/form
packages are released in lockstep to ensure compatibility.
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on U.S. Web Design System (USWDS)
- Inspired by modern form libraries and accessibility best practices
- Thanks to all contributors who have helped shape this project
This is a proof of concept (POC) implementation. While functional, it's under active development.
- Core component architecture
- Monorepo setup with Turborepo
- Component library with TypeScript
- Tailwind CSS integration with shared config
- Storybook for component development
- Class Variance Authority (CVA) for component variants
- ESLint and TypeScript configurations
- Button, Card, and Code components
- Pre-compiled CSS distribution
- Basic form validation
- Initial accessibility testing
- Complete USWDS form components
- Radio buttons and checkboxes
- Date picker
- File upload
- Range slider
- Advanced validation rules
- Form state management
- Error boundary handling
- Internationalization (i18n) support
- Comprehensive documentation site
- Interactive component playground
- Form builder UI
- VS Code extension for snippets
- CLI tool for scaffolding
- Storybook integration
- Performance optimizations
- 100% test coverage
- Security audit
- Bundle size optimization
- SSR/SSG support verification
- Migration guides from other form libraries
- Mobile-specific optimizations
- Advanced theming system
- Plugin architecture
- GraphQL/REST API integration helpers