react-bits
The largest open-source library of animated, interactive, and customizable React & Next.js components for building standout web products and experiences. Built for humans and AI agents.
Top Related Projects
Cheatsheets for experienced React developers getting started with TypeScript
The React documentation website
A collection of awesome things regarding React ecosystem
Curated List of React Components & Libraries.
JavaScript Style Guide
Quick Overview
React-bits is a collection of React patterns, techniques, tips, and tricks. It serves as a comprehensive resource for React developers, offering insights into best practices, performance optimizations, and common pitfalls to avoid when working with React.
Pros
- Extensive coverage of React concepts and patterns
- Well-organized and easy to navigate
- Regularly updated with new content
- Includes practical examples and explanations
Cons
- May be overwhelming for beginners due to the large amount of information
- Some advanced topics might require additional background knowledge
- Not a structured tutorial or course, which might not suit all learning styles
- Some examples may become outdated as React evolves
Code Examples
Here are a few code examples from the React-bits repository:
- Conditional Rendering:
const MyComponent = ({ isLoggedIn }) => (
<div>
{isLoggedIn ? (
<LogoutButton />
) : (
<LoginButton />
)}
</div>
);
This example demonstrates how to conditionally render components based on a prop.
- Higher-Order Components (HOC):
const withLoading = (WrappedComponent) => {
return class extends React.Component {
state = {
isLoading: true,
};
componentDidMount() {
// Simulate API call
setTimeout(() => {
this.setState({ isLoading: false });
}, 2000);
}
render() {
return this.state.isLoading ? (
<LoadingSpinner />
) : (
<WrappedComponent {...this.props} />
);
}
};
};
This HOC adds loading functionality to any component it wraps.
- Using React Hooks:
import React, { useState, useEffect } from 'react';
const DataFetcher = () => {
const [data, setData] = useState(null);
useEffect(() => {
fetchData().then(result => setData(result));
}, []);
return (
<div>
{data ? <DisplayData data={data} /> : <LoadingSpinner />}
</div>
);
};
This example shows how to use the useState and useEffect hooks to manage state and side effects in a functional component.
Getting Started
To start using React-bits:
- Visit the GitHub repository: https://github.com/DavidHDev/react-bits
- Browse through the table of contents to find topics of interest
- Read the explanations and study the code examples provided
- Try implementing the patterns and techniques in your own React projects
- Refer back to the repository when you encounter specific React-related challenges or need inspiration for best practices
Competitor Comparisons
Cheatsheets for experienced React developers getting started with TypeScript
Pros of react
- Focuses specifically on TypeScript with React, providing in-depth TypeScript-related guidance
- Regularly updated with contributions from a large community
- Includes cheatsheets for various React-related topics like hooks, component patterns, and testing
Cons of react
- Less coverage of general React best practices and patterns
- May be overwhelming for beginners due to its focus on TypeScript complexities
- Lacks detailed explanations for some advanced concepts
Code Comparison
react-bits:
const PureComponent = (props) => {
return <div>{props.text}</div>;
};
react:
interface Props {
text: string;
}
const PureComponent: React.FC<Props> = ({ text }) => {
return <div>{text}</div>;
};
The react repository provides TypeScript-specific implementations, including type definitions for props, while react-bits focuses on JavaScript examples. The react code snippet demonstrates how to define prop types using TypeScript interfaces, which can help catch errors during development and improve code maintainability.
The React documentation website
Pros of react.dev
- Official React documentation repository, ensuring up-to-date and accurate information
- Comprehensive coverage of React concepts, including advanced topics and best practices
- Regularly maintained and updated by the React core team and community contributors
Cons of react.dev
- Larger and more complex repository structure, potentially overwhelming for beginners
- Focuses primarily on documentation rather than practical code snippets and examples
- May require more time to navigate and find specific information
Code Comparison
react.dev:
function MyButton() {
return (
<button>I'm a button</button>
);
}
export default function MyApp() {
return (
<div>
<h1>Welcome to my app</h1>
<MyButton />
</div>
);
}
react-bits:
const PureComponent = (props) => {
return (
<div>
{props.name}
</div>
);
};
export default PureComponent;
The react.dev example demonstrates a more complete React application structure, including a custom component and its usage. The react-bits example focuses on a specific concept (Pure Components) with a simpler implementation.
A collection of awesome things regarding React ecosystem
Pros of awesome-react
- More comprehensive coverage of React ecosystem
- Regularly updated with new resources and tools
- Well-organized into clear categories for easy navigation
Cons of awesome-react
- Less focused on specific React patterns and techniques
- May be overwhelming for beginners due to the sheer volume of information
- Lacks detailed explanations for each resource
Code comparison
react-bits focuses on specific React patterns and techniques, often providing code examples:
// Higher Order Component (HOC) example
const withData = WrappedComponent => {
return class extends React.Component {
render() {
return <WrappedComponent data={this.state.data} {...this.props} />;
}
}
}
awesome-react primarily provides links to resources rather than code examples. However, it may include snippets in some sections:
// Example from a linked resource
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
react-bits offers more in-depth code examples and explanations for specific React patterns, while awesome-react serves as a comprehensive directory of React-related resources, tools, and libraries. The choice between the two depends on whether you're looking for specific React techniques or a broader overview of the React ecosystem.
Curated List of React Components & Libraries.
Pros of awesome-react-components
- Extensive collection of React components, libraries, and tools
- Well-organized categories for easy navigation
- Regularly updated with new components and resources
Cons of awesome-react-components
- Lacks in-depth explanations or code snippets for each component
- May overwhelm beginners with the sheer number of options
- Doesn't provide best practices or patterns for React development
Code comparison
react-bits focuses on React patterns and best practices, while awesome-react-components is a curated list of components. Therefore, a direct code comparison isn't applicable. However, here's an example of how they differ in content:
react-bits example (Conditional Rendering):
{condition && <span>Rendered when condition is true</span>}
awesome-react-components example (Component listing):
- [react-burger-menu](https://github.com/negomi/react-burger-menu) - An off-canvas sidebar component with effects.
Summary
react-bits is more suitable for developers looking to improve their React skills and learn best practices, while awesome-react-components serves as a comprehensive directory of ready-to-use components and libraries. The choice between the two depends on whether you're seeking to enhance your React knowledge or find specific components for your project.
JavaScript Style Guide
Pros of javascript
- Comprehensive JavaScript style guide covering a wide range of topics
- Well-maintained with regular updates and contributions from the community
- Includes ESLint configuration for easy implementation
Cons of javascript
- Focuses primarily on JavaScript, with limited React-specific guidance
- May be overwhelming for beginners due to its extensive coverage
Code Comparison
javascript:
// bad
const items = new Array();
// good
const items = [];
react-bits:
// bad
const { users, isLoading } = this.state;
return (
<div>
{isLoading ? <LoadingSpinner /> : <UserList users={users} />}
</div>
);
// good
const { users, isLoading } = this.state;
if (isLoading) {
return <LoadingSpinner />;
}
return <UserList users={users} />;
Summary
javascript is a comprehensive JavaScript style guide maintained by Airbnb, offering extensive coverage of JavaScript best practices and ESLint configuration. react-bits, on the other hand, focuses specifically on React patterns and anti-patterns, providing more targeted guidance for React developers.
While javascript is more comprehensive and regularly updated, it may be overwhelming for beginners and lacks React-specific content. react-bits fills this gap by offering React-centric advice but may not cover broader JavaScript topics as thoroughly.
The code examples demonstrate the different focus areas: javascript emphasizes general JavaScript practices, while react-bits showcases React-specific patterns for improved readability and maintainability.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Animated React components for websites people remember.
215+ free animated components and backgrounds for React.
Tune them yourself, or hand them to your agent.
Documentation · Installation · MCP · Tools · Pro
What's inside
Every component has a live demo with controls, and comes in four flavors: JavaScript or TypeScript, styled with CSS or Tailwind.
| Category | Count | What you'll find |
|---|---|---|
| Text Animations | 33 | Split text, typewriters, rotating words and scroll reveals |
| Animations | 38 | Cursor effects, hover interactions, borders and image effects |
| Components | 48 | Cards, navigation, carousels and galleries |
| Micro | 34 | Buttons, toggles, indicators and other small interface details |
| Backgrounds | 63 | Gradients, particles, grids and shader effects for whole sections |
React Bits Pro
The complete React toolkit for crafting memorable UI. React Bits stays free forever. Pro takes you from individual effects to complete pages, product UI, templates and an Agent Kit, all delivered as source you own.
"Everything about this is next level." â @shadcn
"Paid once, and he keeps shipping updates. Easiest value I've gotten from any tool." â @juandadotdev
Pay once, keep every update. Every file is yours to edit, and lifetime access includes every future update. Want to see how it fits your workflow first? Grab a free template and agent skill, no checkout needed.
Installation
Add any component with the shadcn CLI. The suffix picks the flavor: JS or TS, then CSS or TW.
npx shadcn@latest add @react-bits/SplitText-TS-TW
Or with jsrepo:
npx jsrepo@latest add https://reactbits.dev/r/SplitText-TS-TW
Prefer to copy by hand? Open a component's Code tab, pick your flavor and paste the files into your project. The installation guide covers both.
Use it with your agent
React Bits works with the shadcn MCP server, so Claude Code, Cursor, Codex, VS Code and Antigravity can find and add components for you. Add the registry to your components.json:
{
"registries": {
"@react-bits": "https://reactbits.dev/r/{name}.json"
}
}
Then connect your client, for example npx shadcn@latest mcp init --client claude, and ask for what you need. See the MCP guide for every client.
Creative tools
Five free tools for making assets and sounds with React Bits, right in the browser.
- Background Studio: browse every animated background, start from a preset and tune it live. Export the code, a high-resolution image or a looping MP4 or WebM video.
- Center Stage: turn a screenshot or screen recording into a polished product shot on lifelike phones, laptops and browsers, with 3D tilt, depth of field, shadows and type. Perfect for launch videos or demos. Export 4K images, 4K video, GIFs or a link.
- Shape Magic: design a logo mark from shapes, patterns, text or your own SVG, then give it a 3D material like chrome, glass or neon. Export SVG, PNG, favicons, video or React.
- Texture Lab: run photos, videos or your camera through 160 one-click styles and 75+ stackable effects, from ASCII and halftone to glass and glitch. Export images, videos or GIFs.
- Sound Lab: audition 200 interface and video sounds, tune them and add effects like reverb, echo and filter, then install one with a single command or download WAV, MP3 or OGG.
Sponsors
React Bits is supported by these sponsors. Become a sponsor to reach 500K+ developers every month.
Diamond
Silver
Community
Contributing. Ideas and fixes are welcome. Browse the open issues, suggest something with the feature request template, and read the contribution guide before opening a pull request.
Official ports. React Bits is also available for Vue and Svelte.
Contributors. Thanks to everyone who has helped build React Bits.
Credit
React Bits occasionally draws inspiration from publicly available code examples. These are rewritten as full-fledged, customizable components for JS, TS, CSS and Tailwind. If you recognize your work, open an issue to request credit.
Some Texture Lab effects and Shape Magic materials are adapted from Paper Shaders (Apache 2.0) and Shaders.com by Shader Effects Inc. (MIT). The third-party notices for Texture Lab and Shape Magic list the adapted files and include the licenses.
License
MIT + Commons Clause, free for personal and commercial use. Created and maintained by David Haz.
Top Related Projects
Cheatsheets for experienced React developers getting started with TypeScript
The React documentation website
A collection of awesome things regarding React ecosystem
Curated List of React Components & Libraries.
JavaScript Style Guide
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot