Convert Figma logo to code with AI

DavidHDev logoreact-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.

49,689
2,454
49,689
1

Top Related Projects

47,096

Cheatsheets for experienced React developers getting started with TypeScript

11,792

The React documentation website

A collection of awesome things regarding React ecosystem

Curated List of React Components & Libraries.

148,035

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:

  1. Conditional Rendering:
const MyComponent = ({ isLoggedIn }) => (
  <div>
    {isLoggedIn ? (
      <LogoutButton />
    ) : (
      <LoginButton />
    )}
  </div>
);

This example demonstrates how to conditionally render components based on a prop.

  1. 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.

  1. 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:

  1. Visit the GitHub repository: https://github.com/DavidHDev/react-bits
  2. Browse through the table of contents to find topics of interest
  3. Read the explanations and study the code examples provided
  4. Try implementing the patterns and techniques in your own React projects
  5. Refer back to the repository when you encounter specific React-related challenges or need inspiration for best practices

Competitor Comparisons

47,096

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.

11,792

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.

148,035

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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README


React Bits

Animated React components for websites people remember.

215+ free animated components and backgrounds for React.
Tune them yourself, or hand them to your agent.

GitHub stars License: MIT + Commons Clause

Documentation · Installation · MCP · Tools · Pro


A grid of React Bits components: Topography, Fluid Glass, Liquid Chrome, Circular Gallery, Strands, Gradient ASCII, Split Text, Ballpit, Metallic Paint, Light Tunnel, Profile Card and Laser Flow

What's inside

Every component has a live demo with controls, and comes in four flavors: JavaScript or TypeScript, styled with CSS or Tailwind.

CategoryCountWhat you'll find
Text Animations33Split text, typewriters, rotating words and scroll reveals
Animations38Cursor effects, hover interactions, borders and image effects
Components48Cards, navigation, carousels and galleries
Micro34Buttons, toggles, indicators and other small interface details
Backgrounds63Gradients, 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.

React Bits Pro: 230 animated components, 300 page sections, 300 app UI blocks, 15 full templates and 20 agent skills

"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.

Get React Bits Pro   Browse the catalogue

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, Center Stage, Shape Magic, Texture Lab and Sound Lab
  • 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

shadcnblocks.com      shaders.com

Silver

shadcnuikit.com     Shadcn Studio

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.

React Bits contributors

Repobeats analytics

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.

NPM DownloadsLast 30 Days