React Bulma Components

4.1.0 · active · verified Sun Apr 19

React Bulma Components is a library providing a comprehensive set of React components that directly implement the Bulma CSS framework, offering a declarative way to build user interfaces adhering to Bulma's design principles. The current stable version is 4.1.0, actively receiving patch and minor updates, with major versions (like v4.0.0) introducing significant breaking changes. Key differentiators include its compatibility across popular React frameworks such as Gatsby, Create React App, and Next.js. Since version 4, the library supports tree-shaking by default, optimizing bundle sizes. It also provides a unique `domRef` prop for passing refs to underlying DOM elements, bypassing React's `forwardRef` to reduce overhead in the React Dev Tools. Developers should note that some component APIs or naming conventions might diverge from official Bulma documentation, necessitating consultation of its Storybook documentation. The library expects Bulma CSS to be provided externally as a peer dependency, offering flexibility for custom SASS setups.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and use several core components like Button, Box, Section, and Container, while also ensuring the necessary Bulma CSS is loaded. It illustrates basic component composition and prop usage.

import React from 'react';
import 'bulma/css/bulma.min.css';
import { Button, Box, Section, Container } from 'react-bulma-components';

const App = () => {
  return (
    <Section>
      <Container>
        <Box>
          <p className="title is-4">Welcome to React Bulma Components</p>
          <Button color="primary" onClick={() => alert('Hello Bulma!')}>
            Click Me
          </Button>
          {' '}
          <Button color="link" renderAs="a" href="https://react-bulma.dev/" target="_blank" rel="noopener noreferrer">
            Visit Docs
          </Button>
        </Box>
      </Container>
    </Section>
  );
};

export default App;

view raw JSON →