npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@butterflai-ui/core

v0.0.29

Published

A React component library for building modern web applications using Tailwind CSS.

Downloads

431

Readme

Butterflai-UI, Effortless user interfaces

npm latest package

Introduction

Built specifically for use with React and Tailwind CSS, Butterflai-UI offers a range of accessible, highly customizable components that can be easily integrated into any react project. Butterflai-UI comes with a set of default styles that can be using Tailwind CSS classes. Furthermore, each component can be parameterized using a set of props that can be used to change the default styles of the component.

Installation

Butterflai-UI is available as an NPM package and can be installed using the following command:

npm install @butterflai-ui/core

Configuration

Butterflai-UI is designed to be used with React and Tailwind CSS. To use Butterflai-UI, you must first install ReactJS and Tailwind CSS in your project. Furthermore, you must also install the following NPM packages:

npm install tailwind-scrollbar @tailwindcss/forms @tailwindcss/typography tailwind-merge class-variance-authority

After having installed Tailwind CSS, you must configure it to work with Butterflai-UI. To do this, you must first create a tailwind.config.js file in the root directory of your project. Then, add the following code to that config file:

It is highly recommended to add only the needed style files to avoid having a bloated css file

module.exports = {
  content: [
    './src/**/*.{html,jsx,tsx}',
    // you can either add all styles
    './node_modules/@butterflai-ui/core/dist/theme/styles/*.js',
    // OR you can add only the styles you need
    './node_modules/@butterflai-ui/core/dist/theme/styles/Button.styles.js',
    './node_modules/@butterflai-ui/core/dist/theme/styles/Text.styles.js'
  ],
  plugins: [
    require('@tailwindcss/typography'),
    require('tailwind-scrollbar')({ nocompatible: true }),
    require('@tailwindcss/forms')({
      strategy: 'class' // only generate classes
    })
  ]
};

Usage

To start using Butterflai-UI components just add the following import statement to the top of your React component:

import { Button } from '@butterflai-ui/core';

Then, you can use the component in your JSX code:

<Button>Click Me</Button>

Properties

Each component has a set of default styles that can be parameterized using the corresponding props. For example, the Button component has a default blue color and a medium size. These values can be changed by setting the color and size props to the component:

<Button color="black" size="sm">Click Me</Button>

Moreover, the style of a component can be customized by passing the normal className prop to it. This prop can be used to override the default styles of the component. For example, the following code will change the font weight of the button to semi-bold:

Butterflai-UI is using tailwind-merge to merge the default classes with the classes you provide in the className prop and resolve any possible conflicts.

  <Button color="black" size="sm" className="font-semibold">Click Me</Button>

Variants

Trying to avoid to make the user use multiple properties again and again we have created a variant prop. A variant is basically a pre-defined set of properties that can be used to customize a component. For example, the Button component has a success variant that can be used to create a bootstrap-like success button:

  <Button variant="success">Click Me</Button>

You can read more about the variants of each component in their corresponding documentation page.

Customization

All Butterflai-UI components are highly customizable. This means that you can easily change the default styles of a component by overriding the corresponding Tailwind CSS classes

Credits

  • Nick Dunas - For his open source library Rewind-UI.

Special thanks to the following teams:

  • React - For creating React.
  • Tailwind Labs - For creating Tailwind CSS.
  • Floating-UI - For creating Floating-UI.
  • Dnd-kit - For creating A lightweight, performant, accessible and extensible drag & drop toolkit for React.