nano-css comes only with a single put() addon pre-installed. However, it has
plenty more to chose from. Below is a list of addons shipped with nano-css.
put()— injects CSS styles given a selectorrule()— injects CSS styles and returns a generated selectordrule()— likerule(), but allows to add on-the-fly overridessheet()— collection ofrule()s, injects CSS styles only when useddsheet()— likesheet(), but allows to add on-the-fly overridesjsx()— creates styling blocks for virtual DOM librariesuseStyles()— addsstylesas a second argument for your componentwithStyles()— injectsstylesprop into your componentdecorator— provides@cssdecorator for styling stateful React componentscomponent— provides ReactComponentclass to inherit fromstyle()— allows you to create styled componentsstyled()()— better syntax for styled componentshyperstyle()— creates styled hyperscripthfunctionstable— generates consistent class namesatoms— CSS shorthands for better DXnesting— better nesting featureskeyframes()— adds@keyframessupporthydrate— adds support for re-hydration on client sideprefixer— auto-prefixes your styles with correct vendor prefixesstylis— write CSS as stringsunitless— automatically addspxto styles!important— adds!importantto all declarations:global— allows emitting global stylesanimate/*— collection of animation stylesreset/*— collection of CSS resetsreset-font— global styles for better fontgoogleFont()— loads custom fonts from Google Fonts
All addons are in the nano-css/addon/ folder and are exported
as an addon named export. Addon is simply a function that receives nano-css renderer object
as a single argument.
When these docs mention that you need to install an addon, say xxx, you simply import it
from the addon folder and apply to the nano renderer object:
import {addon as addonXXX} from 'nano-css/addon/xxx';
addonXXX(nano);
nano.xxx(/* ... */);Here we install rule() and atoms addons:
import {create} from 'nano-css';
import {addon as addonRule} from 'nano-css/addon/rule';
import {addon as addonAtoms} from 'nano-css/addon/atoms';
const nano = create();
addonRule(nano);
addonAtoms(nano);