bass-component
v1.0.0
Published
React component for styling elements with a Basscss-like API
Downloads
6
Readme
bass-component
React component for styling elements with a Basscss-like API
npm i bass-componentsimport React from 'react'
import Bass from 'bass-component'
const App = props => (
<Bass p3>
<Bass.h1
mt0
mb2
h1
children='Hello'
/>
</Bass>
)Bass-component will automatically insert the minimal amount of CSS needed to render into the head of the document.
API
Props
All bass-component style props are booleans.
Display:
blockdisplay: blockinlineBlockdisplay: inline-blockinlinedisplay: inlineflexdisplay: flexinlineFlexdisplay: inline-flextabledisplay: tabletableCelldisplay: tableCellleftfloat: leftrightfloat: right
Typography:
h1font-size: 32pxh2font-size: 24pxh3font-size: 20pxh4font-size: 16pxh5font-size: 14pxh6font-size: 12pxboldfont-weight: boldcentertext-align: centercapstext-transform: uppercase; letter-spacing: 0.2emnowrapwhite-space: nowrap
Margin:
m0margin: 0m1margin: 8pxm2margin: 16pxm3margin: 32pxm4margin: 64pxmt0margin-top: 0mt1margin-top: 8pxmt2margin-top: 16pxmt3margin-top: 32pxmt4margin-top: 64pxmr0margin-right: 0mr1margin-right: 8pxmr2margin-right: 16pxmr3margin-right: 32pxmr4margin-right: 64pxmb0margin-bottom: 0mb1margin-bottom: 8pxmb2margin-bottom: 16pxmb3margin-bottom: 32pxmb4margin-bottom: 64pxml0margin-left: 0ml1margin-left: 8pxml2margin-left: 16pxml3margin-left: 32pxml4margin-left: 64pxmx0margin-left: 0; margin-right: 0mx1margin-left: 8px; margin-right: 8pxmx2margin-left: 16px; margin-right: 16pxmx3margin-left: 32px; margin-right: 32pxmx4margin-left: 64px; margin-right: 64pxmy0margin-top: 0; margin-bottom: 0my1margin-top: 8px; margin-bottom: 8pxmy2margin-top: 16px; margin-bottom: 16pxmy3margin-top: 32px; margin-bottom: 32pxmy4margin-top: 64px; margin-bottom: 64pxmx-1margin-top: -8px; margin-bottom: -8pxmx-2margin-top: -16px; margin-bottom: -16pxmx-3margin-top: -32px; margin-bottom: -32pxmx-4margin-top: -64px; margin-bottom: -64pxmlAutomargin-left: automrAutomargin-right: automxAutomargin-left: auto; margin-right: auto
Padding:
p0padding: 0p1padding: 8pxp2padding: 16pxp3padding: 32pxp4padding: 64pxpt0padding-top: 0pt1padding-top: 8pxpt2padding-top: 16pxpt3padding-top: 32pxpt4padding-top: 64pxpr0padding-right: 0pr1padding-right: 8pxpr2padding-right: 16pxpr3padding-right: 32pxpr4padding-right: 64pxpb0padding-bottom: 0pb1padding-bottom: 8pxpb2padding-bottom: 16pxpb3padding-bottom: 32pxpb4padding-bottom: 64pxpl0padding-left: 0pl1padding-left: 8pxpl2padding-left: 16pxpl3padding-left: 32pxpl4padding-left: 64pxpx0padding-left: 0; padding-right: 0px1padding-left: 8px; padding-right: 8pxpx2padding-left: 16px; padding-right: 16pxpx3padding-left: 32px; padding-right: 32pxpx4padding-left: 64px; padding-right: 64pxpy0padding-top: 0; padding-bottom: 0py1padding-top: 8px; padding-bottom: 8pxpy2padding-top: 16px; padding-bottom: 16pxpy3padding-top: 32px; padding-bottom: 32pxpy4padding-top: 64px; padding-bottom: 64px
HTML element
By default the Bass component renders a <div>.
To change the underlying element, use dot notation for the component
or use the is prop.
<Bass.h1 /><Bass is='h1' />Bass.component()
A styled-components-like higher order component for applying bass-component props to any component that accepts className as a prop.
import { Link } from 'react-router'
import Bass from 'bass-component'
const BassLink = Bass.component(Link)Bass.css()
Gets a CSS ruleset string based on what has rendered – useful for server-side rendering.
MIT License
