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