A clean, modern single-page application built with React, TypeScript, and Tailwind CSS v4. Mobile-first, accessible, and production-ready.
- Node.js 18+ and npm
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewThe app will be available at http://localhost:5173
my-agent-ui/
βββ src/
β βββ components/ # Reusable components
β β βββ Seo.tsx # SEO component for meta tags
β β βββ ThemeToggle.tsx # Dark mode toggle
β βββ hooks/ # Custom React hooks
β β βββ useTheme.ts # Theme management hook
β βββ layouts/ # Layout components
β β βββ SiteLayout.tsx # Main layout with header/footer
β βββ pages/ # Page components
β β βββ Home.tsx # Home page
β β βββ Features.tsx # Features page
β β βββ Docs.tsx # Documentation page
β β βββ Pricing.tsx # Pricing page
β β βββ About.tsx # About page
β β βββ Contact.tsx # Contact page
β β βββ NotFound.tsx # 404 page
β βββ routes/ # Route configuration
β β βββ AppRoutes.tsx # React Router setup
β βββ App.tsx # Root component
β βββ main.tsx # Entry point
β βββ index.css # Global styles & Tailwind
βββ public/ # Static assets
βββ index.html # HTML template
βββ tailwind.config.js # Tailwind configuration
βββ postcss.config.js # PostCSS configuration
βββ vite.config.ts # Vite configuration
- Create the page component in
src/pages/:
// src/pages/NewPage.tsx
export default function NewPage() {
return (
<div className="min-h-screen py-12 sm:py-16 lg:py-20">
<div className="container mx-auto px-4 sm:px-6 lg:px-8">
<h1 className="text-4xl font-bold text-gray-900 dark:text-gray-100">
New Page
</h1>
{/* Your content */}
</div>
</div>
);
}- Add the route in
src/routes/AppRoutes.tsx:
import { lazy } from "react";
const NewPage = lazy(() => import("../pages/NewPage"));
// In the Routes component:
<Route path="new-page" element={<NewPage />} />- Add navigation link in
src/layouts/SiteLayout.tsx:
<NavLink className={navItem} to="/new-page">New Page</NavLink>Edit src/pages/Home.tsx to customize:
- Hero section text and buttons
- Features grid items
- Tech stack section
- Call-to-action section
- Update Tailwind config (
tailwind.config.js):
export default {
theme: {
extend: {
colors: {
primary: {
50: '#...',
500: '#...',
900: '#...',
}
}
}
}
}- Modify global styles in
src/index.css:
/* Update button colors */
.btn {
@apply bg-primary-500 hover:bg-primary-600;
}The dark mode is handled by the useTheme hook in src/hooks/useTheme.ts.
To customize:
- Modify theme colors in
src/index.css - Update dark mode classes throughout components
- Change the default theme in
index.htmlscript
Edit src/layouts/SiteLayout.tsx:
- Change logo text/component
- Add/remove navigation items
- Modify mobile menu behavior
- Update header styling
Edit the footer section in src/layouts/SiteLayout.tsx:
- Change copyright text
- Add social links
- Modify footer layout
- Create component in
src/components/:
// src/components/MyComponent.tsx
export default function MyComponent() {
return (
<div className="card">
{/* Component content */}
</div>
);
}- Import and use in pages:
import MyComponent from "../components/MyComponent";
export default function MyPage() {
return (
<div>
<MyComponent />
</div>
);
}This project uses Tailwind CSS v4. Use utility classes directly:
<div className="bg-white dark:bg-gray-900 p-4 rounded-lg">
<h2 className="text-2xl font-bold text-gray-900 dark:text-gray-100">
Title
</h2>
</div>Common utility classes:
bg-white dark:bg-gray-900- Background colorstext-gray-900 dark:text-gray-100- Text colorsp-4 sm:p-6 lg:p-8- Responsive paddingrounded-xl- Border radiushover:shadow-lg- Hover effectstransition-all duration-300- Animations
Add custom classes in src/index.css:
.my-custom-class {
@apply p-4 bg-white dark:bg-gray-900 rounded-lg;
}The contact form in src/pages/Contact.tsx shows the pattern:
<input
className="w-full px-4 py-3 rounded-xl border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-sky-500"
placeholder="Your input"
/>Use Tailwind's transition utilities:
<div className="transition-all duration-300 hover:scale-105 hover:shadow-lg">
{/* Content */}
</div>Or add custom animations in src/index.css:
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}- Mobile-First Design: Responsive on all devices
- Dark Mode: System-aware with persistent toggle
- SPA Routing: React Router v7 with lazy loading
- TypeScript: Full type safety
- Tailwind CSS v4: Modern utility-first styling
- Vite: Lightning-fast development
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- TypeScript for type safety
- ESLint for code quality
- Prettier (optional) for formatting
- Functional components with hooks
npm run buildOutput will be in the dist/ directory, ready to deploy to any static hosting service.
npm install -g vercel
vercelnpm install -g netlify-cli
netlify deploy --prod- Update
vite.config.ts:
export default defineConfig({
base: '/your-repo-name/',
// ...
})- Build and deploy:
npm run build
# Deploy dist/ folder to GitHub Pagesvite.config.ts: Vite build configurationtailwind.config.js: Tailwind CSS customizationpostcss.config.js: PostCSS pluginstsconfig.json: TypeScript configurationeslint.config.js: ESLint rules
- Component Organization: Keep components small and focused
- Type Safety: Use TypeScript types for props and state
- Responsive Design: Always test on mobile, tablet, and desktop
- Dark Mode: Ensure all components work in both light and dark modes
- Accessibility: Use semantic HTML and ARIA labels
- Performance: Use lazy loading for routes and large components
- Check
index.htmlfor the theme script - Verify
useThemehook is working - Check browser console for errors
- Ensure Tailwind classes are in the content paths in
tailwind.config.js - Check PostCSS configuration
- Restart the dev server
- Run
npm installto ensure dependencies are installed - Check TypeScript errors with
npm run build - Verify all imports are correct
MIT License - feel free to use this project for your agent interfaces!
Happy Coding! π