This is a Chrome extension development template built with modern frontend technologies, designed to help developers quickly create powerful Chrome extensions. The project integrates React, TypeScript, Tailwind CSS, and Webpack, with a built-in React Hook for interacting with chrome.storage
and support for communication between popup
and options
pages.
chrome.storage
interactions.popup
and options
pages.Clone the Repository
git clone git@github.com:pickknow/chrome-extension-react-Tailwindcss-typescript.git
cd [repo-name]
Install Dependencies
npm install
npm run dev
This starts the development environment, watching for changes and generating unminified builds.
npm run build
Generates optimized extension files in the dist directory.
├── src/
│ ├── popup.tsx/html # Popup page code
│ ├── options.tsx/html # Options page code
│ ├── tools/ # Custom React Hooks (e.g., chrome.storage)
│ ├── assets/ # Static assets (images, styles, etc.)
│ ├── compontments/ # Reusable React components
│ ├── manifest.json # Chrome extension configuration file
│ └── ...
├── dist/ # Build output directory
├── webpack.config.js # Webpack configuration file
└── ...
Customize the Extension Edit src/manifest.json to configure basic extension details (name, version, permissions, etc.). Write your logic in src/popup and src/options. Use tools/useChromeStorage.ts to interact with Chrome storage.
Example: Storing Data
export default function App() {
const [count1, setCount1] = useChromeStorageLocal<number>("count1", 0);
return (
<div className='flex gap-10 items-center'>
<p>Stored Count1: {count1}</p>
<button className="btn btn-primary" onClick={() => setCount1(count1 + 1)}>Increment</button>
<button className="btn btn-primary" onClick={() => setCount1(0)}>Reset</button>
</div>
);
};
Contributions are welcome! Feel free to submit Issues or Pull Requests to improve this project. Follow these steps:
This project is licensed under the MIT License (LICENSE).