Skip to content
View colliejs's full-sized avatar

Block or report colliejs

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
colliejs/README.md

Advantages

  • static CSS-In-JS: with the flexible of JavaScript
  • extendable: extend the base Component to enhance the ability
  • composable: use mixins to compose mixin
  • variants supports:
  • easy to use: in 99% of cases, you only need to use the styled function.
  • No style collision: CSS encapsulation makes it easy to extend and override styles.
  • Better performance: transform the CSS object at build time.
  • Boost your development with @collie-ui/css or tailwindcss(incoming).
  • Excellent DX with typescript type hints.
  • Supports server-side rendering with nextjs.
  • Supports CSS breakpoint array syntax.
  • Supports theme customization and CSS property customization, simplifying CSS development.
  • have a best integration with react, webpack, rollup, vite, nextjs.

Example

import { absYCenter } from "@collie-ui/css";
import { makeStyled } from "@colliejs/react";
import { collieConfig } from "../collie.config";
export const styled = makeStyled(collieConfig);

const size = variant({
  big: {
    width: 9999,
  },
  sm: {
    width: 20,
  },
});

export const StyledButton = styled("button", {
  w: 100,
  h: 40,
  ...size.big,
  _hover: {
    opacity: 0.8,
    background: "$primary",
    borderRadius: 10,
    color: "white",
  },
  _after: {
    h: "100%",
    w: [10, 4],
    background: "red",
    ...absYCenter({ right: 0 }),
  },

  variants: {
    size: {
      full: {
        w: "100%",
      },
      big: {
        w: 80,
      },
      md: {
        w: 40,
      },
      sm: {
        w: 20,
      },

      dynamic: x => ({
        //any size you want
        w: x,
      }),
    },
    shape: {
      round: {
        borderRadius: 9999,
      },
      rect: {
        borderRadius: 0,
      },
    },
    status: {
      disabled: {
        cursor: "not-allowed",
        background: "$gray200",
      },
    },
    type: {
      subtitle:{
        mixins: ["size.big", "shape.rect"],
      },
      title: {
        minxins: ["type.subtitle", "shape.rect"],
      },
    },
  },

  compoundVariants: [
    {
      size: "big",
      shape: "round",
      css: {
        background: "$gray200",
      },
    },
  ],
  defaultVariants: {
    shape: "rect",
  },
});

How to use

import {css} from '@colliejs/core'
const App = (props)=> {
  return <Button shape="round" disabled={props.disabled} className={css({background:'red'})}>Login<Button/>
}

Get started

completed demo

know more about examples,

  git clone https://github.com/colliejs/examples && cd examples && pnpm install && pnpm dev

How does it work

  • transform the styled object to css text at build time

Big thanks

  • stitches - a css-in-js library with multi-variant support

Popular repositories Loading

  1. colliejs colliejs Public

    type-safe static extract CSS-in-JS library with variant support, framework agnostic, easy to extend or compose

    TypeScript 6

  2. collie-ui collie-ui Public

    utility first unstyled ui library

    TypeScript 1

  3. examples examples Public

    TypeScript