4.2.0 ā€¢ Published 2 years ago

@otovo/rainbow-tailwind v4.2.0

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
2 years ago

šŸŒˆ rainbow-tailwind

Otovo's design system implemented using Tailwind

Getting started

  1. Setup Tailwind by following the instructions in the official Tailwind installation documentation.

  2. Install @otovo/rainbow-tailwind

yarn add @otovo/rainbow-tailwind
  1. Create the file tailwind.config.js at the root of your project. This is where we add the Rainbow overrides:
const plugin = require('tailwindcss/plugin');
const { theme, variants, plugins } = require('@otovo/rainbow-tailwind/dist');

module.exports = {
  theme,
  variants,
  plugins: Object.values(plugins).map((p) => plugin(p)),
  prefix: '_',
};
  1. Profit! āœØ

Documentation šŸ“š

Rainbow documentation is available at https://rainbow.otovo.com, and updated using the rainbow-documentation repo. Remember to update the documentation when making changes.

It is highly recommended to read the official Tailwind documentation, as this projects depend upon it heavily.

Development šŸ‘©šŸ¼ā€šŸ’»

To make it easier to test changes to rainbow-tailwind locally, you can set up a link to cloud or rainbow-documentation (or both). Linking the repo can be done as follows (assuming you have placed the repos in ~/projects):

cd ~/projects/rainbow-tailwind
yarn link

cd ~/projects/cloud
yarn link @otovo/rainbow-tailwind

Great! You're almost set. To rebuild the distribution whenever you change something, run...

yarn dev

Publishing šŸ“¦

To release a new version to NPM, run...

yarn release

The script will hold your hand through the rest of the process. Remember to use semantic versioning.

Rainbows everywhere

Using Tailwind with Rainbow in Cloud

To use rainbow-tailwind

In order to use tailwind with the raibow-tailwind, some classes name need to be adapted when you will have to code some UI using rainbow-tailwind

Prefix '_' to use Tailwind in Cloud:

To be able to use Tailwind classes, they need to be call with the prefix '_' For instance, if you want to set a fixed width, you will see in the Tailwind's documentation the following syntax:

<div class="w-8 ..."></div>

In cloud, you will have to write:

<div class="_w-8 ..."></div>

Responsive classes:

Rainbow has its own breakpoint delimiters. If you want to use the responsive classes described in Tailwind's documentation, you will have to use the matching syntax in Rainbow:

Tailwind Breakpoint prefixRainbow-tailwind equivalentMinimum width
āŒs2368px
āŒs3480px
smm640px
mdm2768px
āŒm3960px
lgl1024px
xll21280px
2xll31536px

Font classes:

Font classes used in Rainbow are matching the ones used in Tailwind except text-base:

Taiwind classRainbow-tailwind class
text-base_text-md

Width: Taiwind class | Rainbow-tailwind class | Properties -- | -- | -- w-| _w-0 | width: 0px; w-0.5| āŒ| 0.125 rem; w-1 | _w-1 | width: 0.25rem; w-1.5 |āŒ | width: 0.375rem; w-2 | _w-2 | width: 0.5rem; w-2.5 |āŒ | width: 0.625rem; w-3 | _w-3 | width: 0.75rem; w-3.5 | āŒ| width: 0.875rem; w-4 | _w-4 | width: 1rem; w-5 | _w-5 | width: 1.25rem; w-6 | _w-6 | width: 1.5rem; w-7 |āŒ | width: 1.75rem; w-8 | _w-8 | width: 2rem; w-9 | āŒ| width: 2.25rem; w-10 | _w-8 | width: 2.5rem; w-11 | āŒ| width: 2.75rem; w-12 | _w-12 |width: 3rem; w-14 | āŒ| width: 3.5rem; w-16 | _w-16 | width: 4rem; w-20 | _w-20 |width: 5rem; w-24 | _w-24 | width: 6rem; w-28 | āŒ| width: 7rem; w-32 | _w-32 | width: 8rem; w-36 | āŒ| width: 9rem; w-40 | _w-40 | width: 10rem; w-44 |āŒ| width: 11rem; w-48 | _w-48 | width: 12rem; w-52 |āŒ| width: 13rem; w-56 | _w-56 | width: 14rem; w-60 | āŒ| width: 15rem; w-64 | _w-64 | width: 16rem; w-72 | āŒ| width: 18rem; w-80 | _w-80 | width: 20rem; w-96 |_w-96 | width: 24rem; āŒ| _w-112 | 28rem āŒ| _w-128 | 32rem āŒ| _w-160 | 40rem āŒ| _w-192 | 48rem āŒ| _w-224 | 56rem āŒ| _w-256 | 64rem āŒ| _w-320 | 80rem āŒ| _w-384 | 96rem w-auto | _w-auto | width: auto; w-px |_w-px| width: 1px; w-1/2 | _w-1/2 | width: 50%; w-1/3 | _w-1/3 | width: 33.333333%; w-2/3 |_w-2/3| width: 66.666667%; w-1/4 |_w-1/4| width: 25%; w-2/4 | _w-2/4 | width: 50%; w-3/4 | _w-3/4| width: 75%; w-1/5 |_w-1/5 | width: 20%; w-2/5 | _w-2/5 | width: 40%; w-3/5 |_w-3/5 | width: 60%; w-4/5 |_w-4/5 | width: 80%; w-1/6 |_w-1/6 | width: 16.666667%; w-2/6 | _w-2/6 | width: 33.333333%; w-3/6 |_w-3/6 | width: 50%; w-4/6 | _w-4/6 | width: 66.666667%; w-5/6 | _w-5/6| width: 83.333333%; w-1/12 |_w-1/12 | width: 8.333333%; w-2/12 |_w-2/12| width: 16.666667%; w-3/12 | _w-3/12 | width: 25%; w-4/12 | _w-4/12 | width: 33.333333%; w-5/12 | _w-5/12 | width: 41.666667%; w-6/12 | _w-6/12 | width: 50%; w-7/12 | _w-7/12 | width: 58.333333%; w-8/12 |_w-1/2 | width: 66.666667%; w-9/12 | _w-8/12 | width: 75%; w-10/12 |_w-10/12 | width: 83.333333%; w-11/12 |_w-11/12 | width: 91.666667%; w-full | _w-full |width: 100%; w-screen | _w-screen |width: 100vw;

Max-width:

Taiwind classRainbow-tailwind classProperties
max-w-0_w-max-0max-width: 0rem;
max-w-none_max-w-nonemax-width: none;
max-w-xs_max-w-80max-width: 20rem;
max-w-sm_max-w-96max-width: 24rem;
max-w-md_max-w-112max-width: 28rem;
max-w-lg_max-w-128max-width: 32rem;
max-w-xlāŒmax-width: 36rem;
max-w-2xlāŒmax-width: 42rem;
max-w-3xl_max-w-128max-width: 48rem;
max-w-4xl_max-w-224max-width: 56rem;
max-w-5xl_max-w-256max-width: 64rem;
max-w-6xlāŒmax-width: 72rem;
max-w-7xl_max-w-320max-width: 80rem;
max-w-full_max-w-fullmax-width: 100%;
max-w-mināŒmax-width: min-content;
max-w-maxāŒmax-width: max-content;
max-w-proseāŒmax-width: 65ch;
max-w-screen-sm?tbdmax-width: 640px;
max-w-screen-md?max-width: 768px;
max-w-screen-lg? tbdmax-width: 1024px;
max-w-screen-xlāŒmax-width: 1280px;
max-w-screen-2xlāŒmax-width: 1536px;

Min-width: Taiwind class | Rainbow-tailwind class | Properties -- | -- | -- min-w-0 | _w-min-0 | min-width: 0rem; āŒ| _min-w-none | min-width: none; āŒ| _min-w-80 | min-width: 20rem; āŒ|_min-w-96 | min-width: 24rem; āŒ| _minw-112 | min-width: 28rem; āŒ| _min-w-128 | min-width: 32rem; āŒ| _min-w-128 | min-width: 48rem; āŒ| _min-w-224 | min-width: 56rem; āŒ| _min-w-256 |min-width: 64rem; āŒ| _min-w-320 | min-width: 80rem; min-w-full | _min-w-full | min-width: 100%; āŒ| _min-screen| screen: '100vw'

Height: Taiwind class | Rainbow-tailwind class | Properties -- | -- | -- h-0 | _h-0 | height: 0px; h-0.5 | āŒ|height: 0.125rem; h-1 | _h-1 |height: 0.25rem; h-1.5 | āŒ| height: 0.375rem; h-2 | _h-2 | height: 0.5rem; h-2.5 | āŒ| height: 0.625rem; h-3 |_h-3 | height: 0.75rem; h-3.5 | āŒ| height: 0.875rem; h-4 | _h-4 | height: 1rem; h-5 | _h-5| height: 1.25rem; h-6 | _h-6| height: 1.5rem; h-7 | āŒ| height: 1.75rem; h-8 | _h-8| height: 2rem; h-9 | āŒ|height: 2.25rem; h-10 |_h-10 | height: 2.5rem; h-11 | āŒ| height: 2.75rem; h-12 | _h-12 |height: 3rem; h-14 | āŒ| height: 3.5rem; h-16 | _h-16 |height: 4rem; h-20 |_h-20 | height: 5rem; h-24 | _h-24 |height: 6rem; h-28 | āŒ| height: 7rem; h-32 | _h-32 |height: 8rem; h-36 | āŒ|height: 9rem; h-40 | _h-40 |height: 10rem; h-44 | āŒ| height: 11rem; h-48 | _h-48 |height: 12rem; h-52 | _h-52 |height: 13rem; h-56 |_h-56 | height: 14rem; h-60 | āŒ| height: 15rem; h-64 |_h-64 | height: 16rem; h-72 | āŒ| height: 18rem; h-80 | _h-80 |height: 20rem; h-96 |_h-96 | height: 24rem; h-auto |_h-auto | height: auto; h-px | _h-px | height: 1px; h-1/2 | _h-1/2 | height: 50%; h-1/3 | _h-1/3 | height: 33.333333%; h-2/3 |_h-2/3 | height: 66.666667%; h-1/4 | _h-1/4 |height: 25%; h-2/4 | _h-2/4 | height: 50%; h-3/4 | _h-3/4 | height: 75%; h-1/5 | _h-1/5 | height: 20%; h-2/5 | _h-2/5 | height: 40%; h-3/5 | _h-3/5 | height: 60%; h-4/5 | _h-4/5 | height: 80%; h-1/6 | _h-1/6 | height: 16.666667%; h-2/6 | _h-2/6 | height: 33.333333%; h-3/6 | _h-3/6 | height: 50%; h-4/6 | _h-4/6 | height: 66.666667%; h-5/6 |_h-5/6 | height: 83.333333%; h-full | _h-full | height: 100%; h-screen | _h-screen |height: 100vh;

Max-height: Taiwind class | Rainbow-tailwind class | Properties -- | -- | -- max-h-0 | _max-h-0 | max-height: 0px; max-h-0.5 |āŒ | max-height: 0.125rem; max-h-1 | _max-h-1 |max-height: 0.25rem; max-h-1.5 |āŒ | max-height: 0.375rem; max-h-2 | _max-h-2 | max-height: 0.5rem; max-h-2.5 |āŒ | max-height: 0.625rem; max-h-3| _max-h-3 |max-height: 0.75rem; max-h-3.5|āŒ | max-height: 0.875rem; max-h-4 | _max-h-4 |max-height: 1rem; max-h-5 | _max-h-5 |max-height: 1.25rem; max-h-6 | _max-h-6 |max-height: 1.5rem; max-h-7 |āŒ | max-height: 1.75rem; max-h-8 | _max-h-8 |max-height: 2rem; max-h-9|āŒ | max-height: 2.25rem; max-h-10| _max-h-10 |max-height: 2.5rem; max-h-11|āŒ | max-height: 2.75rem; max-h-12| _max-h-12|max-height: 3rem; max-h-14 |āŒ | max-height: 3.5rem; max-h-16| _max-h-16 |max-height: 4rem; max-h-20| _max-h-20 |max-height: 5rem; max-h-24| _max-h-24 |max-height: 6rem; max-h-28 |āŒ | max-height: 7rem; max-h-32| _max-h-32 |max-height: 8rem; max-h-36 |āŒ | max-height: 9rem; max-h-40| _max-h-40 |max-height: 10rem; max-h-44 |āŒ | max-height: 11rem; max-h-48| _max-h-48 |max-height: 12rem; max-h-52 |āŒ |max-height: 13rem; max-h-56| _max-h-56 |max-height: 14rem; max-h-60 |āŒ | max-height: 15rem; max-h-64| _max-h-64 |max-height: 16rem; max-h-72 |āŒ | max-height: 18rem; max-h-80| _max-h-80 |max-height: 20rem; max-h-96| _max-h-96 |max-height: 24rem; max-h-px| _max-h-px |max-height: 1px; max-h-full| _max-h-full |max-height: 100%; max-h-screen| _max-h-screen |max-height: 100vh;

Min-height: Taiwind class | Rainbow-tailwind class | Properties -- | -- | -- min-h-0 | _w-0 | min-width: 0rem; āŒ| _min-h-none | min-width: none; āŒ| _min-h-80 | min-width: 20rem; āŒ|_min-h-96 | min-width: 24rem; āŒ| _min-h-112 | min-width: 28rem; āŒ| _min-h-128 | min-width: 32rem; āŒ| _min-h-128 | max-width: 48rem; āŒ| _min-h-224 | min-width: 56rem; āŒ| _min-h-256 |min-width: 64rem; āŒ| _min-h-320 |min-width: 80rem; min-h-full | _min-h-full | min-width: 100%; āŒ| _min-screen| screen: '100vw'

MEMO: REM/PX equivalents 1rem = 16px by default REM | PIXELS | -- | -- | 0rem| 0px 0.125 rem|2px 0.25rem|4px 0.375rem|6px 0.5rem|8px 0.625rem|10px 0.75rem|12px 0.875rem|14px 1rem|16px 1.25rem|20px 1.5rem|24px 1.75rem|28px 2rem|32px 2.25rem|36px 2.5rem|40px 2.75rem|44px 3rem|48px 3.5rem|56px 4rem|64px 5rem|80px 6rem|96px 7rem|112px 8rem|128px 9rem|144px 10rem|160px 12rem|192px 13rem|208px 14rem|224px 15rem|240px 16rem|256px 18rem|288px 20rem|320px 24rem|384px 28rem|448px 32rem|512px 40rem|640px 48rem|768px 56rem|896px 64rem|1024px

Colors:

use rainbow colors described at official Rainbow colors

Kitchen sink

You will find in installerweb a file named kitchen-sink.html that shows different rainbow components developped with Tailwind/Jinja2 : kitchen sink in installerweb

4.2.0

2 years ago

4.1.0

2 years ago

4.0.0

2 years ago

4.1.0-1

2 years ago

4.2.0-0

2 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.0.0

4 years ago

1.0.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago