1.1.2 • Published 2 years ago

@hopes/core v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@hopes/core

A framework-agnostic version of hopes

Usage

Basic styling

The css function creates a styling function that returns a CSS className that can be used to style your components.

It's features are:

  • Variants support
  • Compound Variants support
  • Unit conversion (only for pixels at the moment)
  • Custom selectors
import {css} from "@hopes/core"

const button = css({
    // Your Stylings
    backgroundColor: "red"
    color: "black",
    
    // Custom selectors
    "&::before": {
        content: "",
        // ...
    }

    // Variants
    variants: {
        background: {
            blue: {
                backgroundColor: "blue"
            },
            violet: {
                backgroundColor: "violet"
            }
        }
    }
})

// ...

<div className={button()}>...</div>
<div className={button({ background: "blue" })}>...</div>
<div className={button({ background: "violet" })}>...</div>