Framework-agnostic Web Components library built with TypeScript. Copy and paste components into your project - no npm install required.
- π― Framework Agnostic - Works with React, Vue, Angular, Svelte, or vanilla JavaScript
- π Copy & Paste - No npm packages, full code ownership
- πͺ TypeScript First - Complete type safety
- π¨ Fully Customizable - Own and modify the code
- π Zero Dependencies - Pure Web Components
- βΏ Accessible - Built with ARIA attributes and keyboard navigation
- Node.js 16+ and npm
- TypeScript knowledge (optional but recommended)
# Clone the repository
git clone https://github.com/yourusername/componentkit.git
cd componentkit
# Install dependencies
npm install
# Build TypeScript files
npm run build
# Start development server
npm run serveOpen http://localhost:3000/public/index.html in your browser.
componentkit/
βββ src/
β βββ components/ # Web Component source files
β β βββ button/
β β β βββ ck-button.ts
β β β βββ ck-button.styles.ts
β β β βββ index.ts
β β βββ card/
β β βββ modal/
β β βββ index.ts # Main component registry
β βββ styles/ # Global CSS files
β β βββ variables.css # CSS custom properties
β β βββ global.css # Global styles
β β βββ components.css # Component page styles
β βββ types/ # TypeScript type definitions
β β βββ component-types.ts
β βββ utils/ # Utility functions
β βββ register-components.ts
βββ public/ # Static HTML pages
β βββ index.html # Landing page
β βββ components.html # Component documentation
β βββ assets/ # Images, icons, etc.
βββ dist/ # Compiled JavaScript (generated)
βββ docs/ # Component documentation
βββ package.json
βββ tsconfig.json
βββ README.md
- Browse Components: Visit
/public/components.htmlto see all available components - Copy the Code: Click the "Copy" button to get the TypeScript source
- Paste into Your Project: Add the component files to your project
- Customize: Modify styles and behavior as needed
// Import and use the button component
import './components/button';
// In your HTML
Click Me
// With JavaScript
const button = document.querySelector('ck-button');
button.addEventListener('ck-click', () => {
console.log('Button clicked!');
});Customizable button with multiple variants (primary, secondary, outline)
Primary Button
Secondary Button
Outline ButtonFlexible card layout with header, content, and footer slots
Card Title
Card content goes here
Action
Dialog component with backdrop overlay
Modal Title
Modal content
Close
const modal = document.querySelector('#myModal');
modal.open(); // Opens the modal
modal.close(); // Closes the modalAutomatically rebuild on file changes:
npm run devCompile TypeScript to JavaScript:
npm run buildServe the project locally:
npm run serveEach component has its styles defined in a separate .styles.ts file. Modify these to customize appearance:
// src/components/button/ck-button.styles.ts
export const buttonStyles = `
button {
/* Your custom styles */
}
`;Customize the color scheme by modifying src/styles/variables.css:
:root {
--ck-primary: #6366f1;
--ck-primary-hover: #4f46e5;
/* ... more variables */
}Contributions are welcome! Follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-component) - Follow the existing component structure
- Add documentation for your component
- Commit your changes (
git commit -m 'Add amazing component') - Push to the branch (
git push origin feature/amazing-component) - Open a Pull Request
- Create a new folder:
src/components/your-component/ - Add three files:
your-component.ts- Component logicyour-component.styles.ts- Component stylesindex.ts- Export and registration
- Register in
src/components/index.ts - Add documentation to
public/components.html
Full documentation is available at /public/components.html when running the development server.
ComponentKit uses native Web Components and requires:
- Chrome/Edge 67+
- Firefox 63+
- Safari 10.1+
- Opera 54+
For older browsers, consider using webcomponents.js polyfills.
This project is licensed under the MIT License - see the LICENSE file for details.
Inspired by shadcn/ui - the copy-paste component library approach for React.
- π« Create an issue for bug reports or feature requests
- π¬ Start a discussion for questions or ideas
- β Star this repo if you find it helpful!
Built with β€οΈ using Web Components and TypeScript