A feature-rich, responsive Tic-Tac-Toe game built with React and Tailwind CSS, featuring multiple themes, player customization, game history tracking, and persistent storage.
- Live Website: https://tic-tac-toe-jet-psi.vercel.app
- Classic 3x3 Tic-Tac-Toe mechanics
- Two-player turn-based system
- Win detection with highlighted winning line
- Draw detection when the board is full
- Game timer tracking match duration
- Reset game to start fresh
- Set custom Player X and O names
- Names persist across sessions
- Complete move history with timestamps
- Jump to any previous game state
- Sort moves (Ascending/Descending)
- History persists across sessions
- Tracks win counts for both players
- Tracks total draws
- Persistent across browser sessions
Choose from three visually distinct themes:
- Light Theme – Clean, modern UI with blue accents
- Dark Theme – Dark mode for reduced eye strain
- Colorful Theme – Vibrant gradient backgrounds
- Fully responsive (mobile-first)
- Local Storage Integration for persistence
- Modular component-based architecture
- Optimized re-renders for smooth UI
- Accessibility-friendly design
| Tech | Usage |
|---|---|
| React 18 | Frontend framework |
| Tailwind CSS | Styling & theming |
| Lucide React, Material UI | Icons |
| Vite | Fast build tool |
| React Hooks | State management |
| Local Storage API | Persistent data |
src/
├── components/
│ ├── GameBoard.jsx # Main game grid
│ ├── GameHistory.jsx # Move history
│ ├── GameSettings.jsx # Settings panel
│ ├── GameStatistics.jsx # Win & draw tracking
│ ├── Header.jsx # Application header
│ └── Footer.jsx # Application footer
├── App.jsx # Main application
├── App.css # Global styles
└── index.js # Entry point
Ensure you have Node.js (v22 or higher) installed.
-
Clone the repository:
git clone https://github.com/TheUzair/tic-tac-toe.git cd tic-tac-toe -
Install dependencies:
npm install # or yarn install -
Start the development server:
npm run dev # or yarn dev -
Open in browser:
http://localhost:5173
- Start Game: Player X begins
- Make a Move: Click an empty square
- Alternate Turns: Players take turns placing marks
- Win: Get three in a row (horizontal, vertical, or diagonal)
- Game Features:
- Customize player names
- Toggle between themes
- View and navigate move history
- Reset game anytime
The game automatically saves:
✅ Player Names
✅ Game Statistics
✅ Selected Theme
✅ Move History
Edit src/utils/theme.js to:
- Adjust colors & backgrounds
- Change button styles
- Modify card layouts
Modify GameSettings.jsx to:
- Adjust player name constraints
- Add new themes
- Modify default settings
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- Create a new component in
src/components - Add utility functions in
src/utilsif needed - Import and integrate into
App.jsx - Update the README accordingly
- Fork the repository
- Create a branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for details.
- React.js – The amazing framework
- Tailwind CSS – Utility-first styling
- Lucide React – Elegant icons
- The Open Source Community – For inspiration and contributions