Reactberry
Getting StartedStyle PropsReferenceThe as prop
reactberry/core
reactberry/forms
reactberry/ui
reactberry/theme
reactberry/hooks
Theme

Definition

Style props are a way to alter the style of a component by simply passing props to it. It helps to save time by providing helpful shorthand ways to style components.

Reference

The following table shows a list of every style prop and the properties within each group.

Margin and padding

PropCSS PropertyTheme Key
m, marginmarginspace
mt, marginTopmargin-topspace
mr, marginRightmargin-rightspace
mb, marginBottommargin-bottomspace
ml, marginLeftmargin-leftspace
mxmargin-left and margin-rightspace
mymargin-top and margin-bottomspace
p, paddingpaddingspace
pt, paddingToppadding-topspace
pr, paddingRightpadding-rightspace
pb, paddingBottompadding-bottomspace
pl, paddingLeftpadding-leftspace
pxpadding-left and padding-rightspace
pypadding-top and padding-bottomspace

Color and background color

PropCSS PropertyTheme Key
colorcolorcolors
bg, backgroundbackgroundcolors
opacityopacitynone

Typography

PropCSS PropertyTheme Key
fontFamilyfont-familyfonts
fontSizefont-sizefontSizes
fontWeightfont-weightnone
lineHeightline-heightnone
letterSpacingletter-spacingnone
textAligntext-alignnone
fontStylefont-stylenone
textTransformtext-transformnone
textDecorationtext-decorationnone

Layout, width and height

PropCSS PropertyTheme Key
widthwidthsizes
heightheightsizes
minWidthmin-widthsizes
maxWidthmax-widthsizes
minHeightmin-heightsizes
maxHeightmax-heightsizes
displaydisplaynone
sizewidth, heightsizes
verticalAlignvertical-alignnone
overflowoverflownone
overflowXoverflowXnone
overflowYoverflowYnone

Flexbox

PropCSS PropertyTheme Key
alignItemsalign-itemsnone
alignContentalign-contentnone
justifyItemsjustify-itemsnone
justifyContentjustify-contentnone
flexWrapflex-wrapnone
flexDirectionflex-directionnone
flexflexnone
flexGrowflex-grownone
flexShrinkflex-shrinknone
flexBasisflex-basisnone
justifySelfjustify-selfnone
alignSelfalign-selfnone
orderordernone

Grid Layout

PropCSS PropertyTheme Key
gridGapgrid-gapspace
gridRowGapgrid-row-gapspace
gridColumnGapgrid-column-gapspace
gridColumngrid-columnnone
gridRowgrid-rownone
gridAreagrid-areanone
gridAutoFlowgrid-auto-flownone
gridAutoRowsgrid-auto-rowsnone
gridAutoColumnsgrid-auto-columnsnone
gridTemplateRowsgrid-template-rowsnone
gridTemplateColumnsgrid-template-columnsnone
gridTemplateAreasgrid-template-areasnone

Layout, width and height

import { Box } from "@reactberry/core"
// verbose
<Box width="100%" height={32} />
// shorthand
<Box w="100%" h="32px" />
// use theme sizing
<Box boxSize="sm" />
// width `50%`
<Box w={1/2} />
// width `256px`
<Box w={256} />
// width `'40px'`
<Box w='40px' />

Position

PropCSS PropertyTheme Field
positionpositionnone
zIndexz-indexnone
toptopspace
rightrightspace
bottombottomspace
leftleftspace

Shadow

PropCSS PropertyTheme Field
textShadowtext-shadowshadows
boxShadowbox-shadowshadows

The as prop

The as prop is a feature that all of our components that allows you to pass an HTML tag or component to be rendered.

For example, say you are using a Button component, and you need to make it a link instead. You can compose a and Button like this:

This allows you to use all of the Button props and all of the a props without having to wrap the Button in an a component.