Git Product home page Git Product logo

react-bulma-components's Introduction

React Bulma Components

Build Status Coverage Status Release Version Npm Downloads

React components for Bulma (v0.9.2) UI compatible with most used React Frameworks (Gatsby, CRA, Next.js)

To Install

npm install react-bulma-components or yarn add -E react-bulma-components

Documentation

You can find the documentation in https://react-bulma.dev/en/storybook

Some components may vary the api/naming convention with the Bulma Docs. Please refer to each stories in the Storybook to see how each component could be used

To Use

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

export default () => (
  <Button color="primary">My Bulma button</Button>
)

Form elements are imported as part of the Form class.

import { Form } from 'react-bulma-components';

const { Input, Field, Control, Label } = Form;

SASS support

Since CSS logic is separated from this library, there is no special setup required with the library. Simply follow the instructions in the official documentation. You only need to make sure the CSS is properly imported for your website.

Starting from v4, tree shaking is supported, so only the code of the components you have imported will be bundled.

FAQ

Use Button to render a Link from React-Router

We allow custom render component on all our components, to do it you can use the renderAs props like this

import React from 'react';
import { Button } from 'react-bulma-components';
import { Link } from 'react-router';

const CustomLink = ({ to }) => {
  return (
    <Button to={to} renderAs={Link}>
      My react router link
    </Button>
  )
}

Adding ref to a component

We use a custom prop to pass down the ref to the next dom object. (instead to the instance of the component).

const TestComponent = () => {
  const buttonRef = useRef(null);
  return <Button domRef={buttonRef}>button</Button>
}

Why we do this instead of using React.forwardRef? The forwardRef wrap the component into another one, because this is a library for wrapping the Bulma Framework cause an overhead and a lot of noise on the component tab of the React Dev Tools.

react-bulma-components's People

Contributors

alexsaenen avatar cereallarceny avatar cleanshooter avatar codebytere avatar couds avatar daftspunk avatar dependabot[bot] avatar dimitarchristoff avatar entropy-ibex avatar icyjoseph avatar jbroadice avatar jdmg94 avatar kennethnym avatar koddr avatar luhis avatar moetezch avatar mrd9483 avatar n0vad3v avatar niwatolli3 avatar robloach avatar rotexhawk avatar sksamuel avatar sszczep avatar stefl avatar tbirand avatar thetechdabbler avatar torbentee avatar ubaltaci avatar vestial avatar yihangho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.