GithubHelp home page GithubHelp logo

isabella232 / typhoon-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dgraph-io/typhoon-ui

0.0 0.0 0.0 2 MB

๐ŸŒ€ typhoon-ui: Token-based React component library built using emotion.

License: Apache License 2.0

JavaScript 3.53% HTML 0.04% TypeScript 96.44%

typhoon-ui's Introduction

๐ŸŒ€ typhoon-ui

License node npm version

โžก View Component Library

[Note: This is a work in progress, API is subject to change]

Installation

npm i @dgraph-io/typhoon-ui

Design System Concepts

Theme

Theme is just a map of tokens & components

{ tokens: { ... }, components: { ... }}

Theme can be accessed from useTheme hook, which gets access to theme object from the ThemeContext. You only need this while creating atoms or molecules.

Tokens

Tokens is a map of values which allow us to build a contraint based design. There is a mapping of CSS properties with the tokens, which can be found in helpers/constants. Every component in the design system is able to resolve the styles against these tokens. Lets see some examples -

Example -

  1. marginTop: 1

    Since marginTop is mapped to tokens.space

    This will resolve to marginTop: tokens.space[1] => marginTop: 8px

  2. background : "pink.light"

    Since background is mapped to tokens.colors

    This will resolve to background: tokens.colors.pink.light => background: #ffc0d6

Every component in the design system is able to resolve the styles

Shortcuts

There are shortcuts configured as well which are defined in helpers/constants

Example -

marginX: ...

will be resolved to -

marginLeft: ... ,
marginRight: ...

Advanced

We can resolve tokens within a string as well like -

Example-

border: {{lineThickness.1}} solid {{colors.pink.light}}

This resolves to

border: {{lineThickness.1}} solid {{colors.pink.light}}

Any valid key between {{ }} will be resolved against token values.


typhoon-ui's People

Contributors

danielmai avatar mbj36 avatar tstreamdoth 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.