Skip to Content

Addons

nano-css ships with a single pre-installed addon (put()). All other features are provided through addons. Each addon is a function that extends the renderer.

Installation Pattern

All addons are in nano-css/addon/ and export an addon named function:

import { addon as addonRule } from 'nano-css/addon/rule'; addonRule(nano); nano.rule({ color: 'red' });

Available Addons

Core API

AddonDescription
put()Inject CSS by selector — pre-installed
rule()Generate class names from CSS objects
drule()Dynamic rules with runtime overrides
sheet()Lazy collection of rules
dsheet()Dynamic sheets with runtime overrides

Styling Components

AddonDescription
jsx()Styled components for virtual DOM
style()Styled components with dynamic templates
styled()()Familiar styled-components API
ComponentReact Component base class
@cssDecorator for class components
useStyles()Styles as second component argument
withStyles()HOC that injects styles prop
hyperstyle()Styled hyperscript function

Utilities

AddonDescription
atomsCSS property shorthands
emmetEmmet-style abbreviations
nestingAdvanced nesting with &
keyframes()@keyframes support
prefixerVendor prefix auto-detection
stableDeterministic class name hashing
unitlessAuto-add px to numeric values
!importantAdd !important to all declarations
:globalEmit global styles
arrayMultiple values for declarations
snakeMethod chaining for CSS objects
tachyonsTachyons-style utilities
stylisWrite CSS as strings
.unitsUnit helper functions
sourcemapsCSS source maps in dev

Advanced

AddonDescription
hydrate()Client-side CSS re-hydration
virtualAtomic CSS splitting
cssomCSSOM rule creation
vcssomVirtual CSSOM diffing
spread()Data attribute selectors
extractBuild-time CSS extraction
limitServer-side size limit
ampAMP compatibility
rtlRight-to-left style flipping
googleFont()Load Google Fonts
animate/*Animation presets
reset/*CSS reset collections
reset-fontFont reset styles
Last updated on