Coder Social home page Coder Social logo

gastonfartek / benefit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cdonohue/benefit

0.0 1.0 0.0 6.51 MB

✨ Utility CSS-in-JS library that provides a set of low-level, configurable, ready-to-use styles

Home Page: https://benefit.netlify.com

License: MIT License

JavaScript 62.11% TypeScript 36.48% CSS 1.10% HTML 0.31%

benefit's Introduction

Benefit Logo


Style web applications using generated utility classes

benefit is a utility CSS-in-JS library that provides a set of low-level, configurable, ready-to-use styles.

Documentation

benefit is framework agnostic, use benefit-react for additional enhancements for React.


React-specific

Install dependencies

Add benefit-react to your project.

yarn add benefit-react

Setup transpilation

Set the jsx pragma at the top of your source file where you intend to use benefit-react.

Similar to a comment containing linter configuration, this configures the jsx babel plugin to use the jsx function instead of React.createElement.

JSX Pragma Documentation

Import the jsx function from benefit-react

/** @jsx jsx */
import { jsx } from "benefit-react"

Now, you're free to use any available utility classes to style your components

/** @jsx jsx */
import { jsx } from "benefit-react"

function MyComponent() {
  return (
    <div className="p-4 bg-orange-300 rounded">
      <p className="p-4 bg-white shadow rounded-sm">
        Williamsburg stumptown iPhone, gastropub vegan banh mi
        microdosingpost-ironic pok pok +1 bespoke dreamcatcher bushwick brunch.
      </p>
    </div>
  )
}

Framework agnostic

Add benefit to your project.

yarn add benefit

Import and use the createBenefit function to create your utility classes

import { createBenefit } from "benefit"

const { styleWith } = createBenefit()

Use styleWith(...) to pass in utility classes

<div class={styleWith("p-4 bg-white text-blue-700")}>
  ...
</div>

benefit's People

Contributors

cdonohue avatar ericclemmons avatar

Watchers

James Cloos 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.