All Projects β†’ queckezz β†’ veel

queckezz / veel

Licence: MIT License
Base react styling components using fela with a design system

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to veel

ui
The Blockstack design system implemented with react, styled-components, and styled-system.
Stars: ✭ 34 (+30.77%)
Mutual labels:  css-in-js, styled-system
Xstyled
A utility-first CSS-in-JS framework built for React. πŸ’…πŸ‘©β€πŸŽ€βš‘οΈ
Stars: ✭ 1,835 (+6957.69%)
Mutual labels:  css-in-js, styled-system
react-native-css-in-js-benchmarks
CSS in JS Benchmarks for React Native
Stars: ✭ 46 (+76.92%)
Mutual labels:  css-in-js, fela
styled-system-figma
Generate theme.js from Figma file
Stars: ✭ 26 (+0%)
Mutual labels:  design-systems, styled-system
Styled System
β¬’ Style props for rapid UI development
Stars: ✭ 7,126 (+27307.69%)
Mutual labels:  design-systems, css-in-js
Design System
Priceline.com Design System
Stars: ✭ 604 (+2223.08%)
Mutual labels:  design-systems, css-in-js
Grid
This package has moved and renamed
Stars: ✭ 2,079 (+7896.15%)
Mutual labels:  css-in-js, styled-system
Figma Theme
Generate development-ready theme JSON files from Figma Styles
Stars: ✭ 130 (+400%)
Mutual labels:  design-systems, css-in-js
system-ui.com
Standards for creating consistent, interoperable user interfaces
Stars: ✭ 64 (+146.15%)
Mutual labels:  design-systems, css-in-js
benefit
✨ Utility CSS-in-JS library that provides a set of low-level, configurable, ready-to-use styles
Stars: ✭ 51 (+96.15%)
Mutual labels:  css-in-js
bredon
A modern CSS value compiler in JavaScript
Stars: ✭ 39 (+50%)
Mutual labels:  css-in-js
visage
Visage design system
Stars: ✭ 12 (-53.85%)
Mutual labels:  css-in-js
elegant-react-ssr
Server-side rendering with create-react-app, React Router v4, Helmet, Redux, and Thunk boilerplate, without ejecting CRA
Stars: ✭ 16 (-38.46%)
Mutual labels:  css-in-js
csstips
CSS Tips to help beginners using CSS in TS / JS
Stars: ✭ 50 (+92.31%)
Mutual labels:  css-in-js
design-tokens-plugin
Support end of life! Delivering consistent Design System. A Sketch plugin that exports Design Tokens to JSON format. You can export colors, typography, icons and utilis. A must-have tool for design system project.
Stars: ✭ 100 (+284.62%)
Mutual labels:  design-systems
styletron-connect
A high-level interface to styletron, similar to react-redux's connect
Stars: ✭ 17 (-34.62%)
Mutual labels:  css-in-js
css-render
Generating CSS using JS with considerable flexibility and extensibility, at both server side and client side.
Stars: ✭ 137 (+426.92%)
Mutual labels:  css-in-js
caple-design-system
Caple Design System is an open-source design system built by Cobalt, Inc.
Stars: ✭ 58 (+123.08%)
Mutual labels:  design-systems
react-awesome-reveal
React components to add reveal animations using the Intersection Observer API and CSS Animations.
Stars: ✭ 564 (+2069.23%)
Mutual labels:  css-in-js
styled-components-docs-zh
πŸ’… styled-components δΈ­ζ–‡ζ–‡ζ‘£ηΏ»θ―‘ πŸ‡ζŒη»­ζ–½ε·₯δΈ­
Stars: ✭ 160 (+515.38%)
Mutual labels:  css-in-js

logo

veel NPM version Js Standard Style

πŸ“¦ Base React styling components using Fela with a design system

  • Low-Level - Exposes only a few components which can be used as a base layer to build your UI components upon
  • Consistency - Uses styled-system which encourages consistency of spacing, typography and color
  • Universal - By using fela it's really easy to prerender your styles on the server or anywhere
npm install veel
const Badge = (props) => (
  <Box
    m={2}
    fontSize={2}
    bg='tomato'
    css={{ textDecoration: 'underline' }}
    {...props}
  />
)

Contents

Example

The following renders a responsive row with two equally divided divs collapsing on mobile.

Example

const CenteredBox = props => (
  <Box
    p={2}
    w={[1, 0.5]}
    css={{ height: '50%' }}
    {...props}
  />
)

const App = () => (
  <Flex
    wrap
    align='center'
    css={{ height: '100vh' }}
  >
    <CenteredBox bg='lightblue'>1</CenteredBox>
    <CenteredBox color='white' bg='blue'>2</CenteredBox>
  </Flex>
)

Usage

  1. Create a fela renderer.
import { createRenderer } from 'veel'
const renderer = createRenderer()
  1. Wrap your application in a StyleProvider so that each veel component has access to the renderer and the optional theme.
import { StyleProvider, Box } from 'veel'

class App extends React.Component {
  render() {
    return (
      <StyleProvider={renderer}>
        <Box is='h1' fontSize={2}>Application</Box>
      </StyleProvider>
    )
  }
}
  1. Now you need some way of injecting the generated css into the html. There are many ways to do it, each with their positive and negative aspects.

Injecting the css dynamically

require('inject-css')(renderer.renderToString())

Render to a sheet list (Next.js example)

This makes the most sense when you create the document skeleton with JSX.

import Document, { Head } from 'next/document'

class CustomDocument extends Document {
  static getInitialProps ({ renderPage }) {
    const page = renderPage()
    const sheets = renderer.renderToSheetList()
    renderer.clear()
    return { ...page, sheets }
  }

  render () {
    const sheets = this.props.sheets
    return (
      <Head>
        {sheets.map(({ type, media, css }) => (
          <style data-fela-type={type} media={media}>{css}</style>
        ))}
      </Head>

      ...
    )
  }
}
  1. You're done!

Components

Box

<Box w={1}>Hello Veel!</Box>

The core layout component. Take a look at styled-system for documentation on <Box /> props.

Box.is

By default a <Box /> component will render out to a div. You can change the tag by providing an is property.

Flex

<Flex wrap center />

View the example on how to use it.

Flex.center

Sets both alignItems and justifyContent to center.

Flex.wrap

Sets flexWrap to wrap.

Flex.column

Sets flexDirection to column.

Flex.justify

CSS justifyContent property.

Flex.align

CSS alignItem property.

Flex.order

CSS order property.

Plugins

By using fela you have a wide variety of plugins available. Check out the plugin list

Recommend plugins

<Box css={{
  animationName: {
  '0%': { color: 'red ' },
  '100%': { color: 'blue' }
  },
}} />

// -> { animationName: 'k1' }

Author

veel Β© Fabian Eichenberger, Released under the MIT License.
Authored and maintained by Fabian Eichenberger with help from contributors (list).

GitHub @queckezz Β· Twitter @queckezz

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].