Building a Modern React Library Starter โ A Quick Guide!
Built a React Component Library Starter
Component Library Recommendations
Best Component Library for Reactjs with Typescript
Videos
Hey devs! ๐
Just wrote a quick guide on my blog for anyone looking to build a React library starter template from scratch. It covers setting up TypeScript, Vite, SWC, Rollup and more to get you production-ready fast!
Check it out and let me know what you think โ feedback is always welcome!
Link to the github repo: https://github.com/Abhirup-99/react-library-starter-template
A modern starter template for building React libraries using SWC, TypeScript, and Rollup. Created due to the lack of existing templates that combine SWC's speed with Rollup's efficient bundle optimization.
โก๏ธ SWC for ultra-fast compilation
๐ฆ Rollup for optimal bundling
๐ท TypeScript support
๐ฏ Generates CJS and ESM builds
๐ช Type definitions included
๐ Source maps support
๐ MIT License
Hey folks! ๐
Link to Github
I've been building React components for different projects, and every time I started a new library, I had to go through the same setup - docs, versioning, releases, etc. And honestly I struggle with tooling of javascript with so many options. So, I took some time and wanted to solve this problem for myself, create something I can rely on.
It might seem like "yet another starter kit", but I tried using kits on Github, but couldn't find something which solved all my needs.
So I made this starter kit that handles stuff like:
Building Typescript (Uses Vite Lib Mode)
Uses Tailwind V3 (Will add on Tailwind V4 soon)
Docusaurus for documentation (Publishes to Github pages)
Auto for versioning and release notes (Releases docs too)
Canary releases for testing
Uses conventional commits
Is Tree Shakeable
The template is ready to use - just clone, configure and start building your components. I wrote an article about building it from scratch if you want to understand how it works (attached in repo), good learning experience.
Hope this helps someone else save some time! Let me know if you have questions.
This is a monorepo which has two packages:
Component Library
Documentation Site
I am running vite in dev mode while developing the package, and then publishing a canary build. And then I am installing that into docusaurus, and using for demos.
I am working on Responsive Preview component using the above starter kit, hope to publish soon.
Edit [13th Feb 2025]
Just updated! Added support for Tailwind CSS v4 in a new package
Now includes:
packages/elements-tw-v4: component library with Tailwind v4
packages/elements: component library with Tailwind v3
apps/docs: Docusaurus documentation site