Home

Awesome

React Stacked

Building blocks for robust cross-platform layouts.

The vision of React Stacked is not to provide any styling or be a full-featured UI library, instead it aims to provide low lever primitives that works the same on different platforms.

Currently supported platforms:

Installation

npm install --save react-stacked

Usage

const { HStack, Text, VStack } = require('react-stacked')

const React = require('react')
const { render } = require('react-dom')

const Example = () => (
  <VStack height='150px'>
    <HStack justifyContent='space-between'>
      <Text>Left</Text>
      <Text>Right</Text>
    </HStack>

    <HStack alignItems='center' justifyContent='center' grow='1'>
      <Text>Center</Text>
    </HStack>
  </VStack>
)

render(<Example />)
Left                             Right



                Center



Components

<TextStyle>

An inline text span

PropertyRequiredType
coloroptionalstring
decorationLineoptional'none' | 'underline' | 'line-through' | 'underline line-through'
familyoptionalstring
sizeoptionalstring | number
transformoptional'none' | 'capitalize' | 'uppercase' | 'lowercase'
variantoptionalArray | 'small-caps' | 'oldstyle-nums' | 'lining-nums' | 'tabular-nums' | 'proportional-nums' | string
weightoptional'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'

<Text>

A block of text

PropertyRequiredTypeComment
alignoptional'left' | 'right' | 'center' | 'justify' | null
allowFontScalingoptionalbooleanSpecifies whether fonts should scale to respect Text Size accessibility settings on supported platforms.
coloroptionalstring
decorationLineoptional'none' | 'underline' | 'line-through' | 'underline line-through'
familyoptionalstring
numberOfLinesoptionalnumber | nullLimit the text to the specified number of lines.
rotateoptionalnumberRotate the text by the specified degrees. The origin of the transformation follows the text alignment.
sizeoptionalstring | number
transformoptional'none' | 'capitalize' | 'uppercase' | 'lowercase'
variantoptionalArray | 'small-caps' | 'oldstyle-nums' | 'lining-nums' | 'tabular-nums' | 'proportional-nums' | string
weightoptional'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
alignSelfoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'Override alignment along the cross axis for this item.
widthoptionalstring | numberThe width of the container.
minWidthoptionalstring | numberThe minimum width of the container.
maxWidthoptionalstring | numberThe maximum width of the container.
heightoptionalstring | numberThe height of the container.
minHeightoptionalstring | numberThe minimum height of the container.
maxHeightoptionalstring | numberThe maximum height of the container.
basisoptionalstring | numberThe flex basis of the container.
growoptionalstring | numberThe flex grow factor of the container.
shrinkoptionalstring | numberThe flex shrink factor of the container.
paddingoptionalstring | number
paddingBottomoptionalstring | number
paddingHorizontaloptionalstring | number
paddingLeftoptionalstring | number
paddingRightoptionalstring | number
paddingTopoptionalstring | number
paddingVerticaloptionalstring | number
borderRadiusoptionalnumber
borderBottomLeftRadiusoptionalnumber
borderBottomRightRadiusoptionalnumber
borderTopLeftRadiusoptionalnumber
borderTopRightRadiusoptionalnumber
borderColoroptionalstring
borderBottomColoroptionalstring
borderLeftColoroptionalstring
borderRightColoroptionalstring
borderTopColoroptionalstring
borderStyleoptional'solid' | 'dotted' | 'dashed'
borderWidthoptionalstring | number
borderBottomWidthoptionalstring | number
borderLeftWidthoptionalstring | number
borderRightWidthoptionalstring | number
borderTopWidthoptionalstring | number
backgroundColoroptionalstring

<HStack>

A horizontal stack

PropertyRequiredTypeComment
alignItemsoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'How to align children along the cross axis.
justifyContentoptional'center' | 'end' | 'start' | 'stretch' | 'space-around' | 'space-between' | 'space-evenly'How to align children within the main axis.
wrapoptionalbooleanWhat happens when children overflow along the main axis.
gapoptionalnumberThe size of the gaps (gutters) between rows and columns.
rowGapoptionalnumberThe size of the gap (gutter) between an element's rows.
columnGapoptionalnumberThe size of the gap (gutter) between an element's columns.
overflowoptional'hidden' | 'visible'Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction
alignSelfoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'Override alignment along the cross axis for this item.
widthoptionalstring | numberThe width of the container.
minWidthoptionalstring | numberThe minimum width of the container.
maxWidthoptionalstring | numberThe maximum width of the container.
heightoptionalstring | numberThe height of the container.
minHeightoptionalstring | numberThe minimum height of the container.
maxHeightoptionalstring | numberThe maximum height of the container.
basisoptionalstring | numberThe flex basis of the container.
growoptionalstring | numberThe flex grow factor of the container.
shrinkoptionalstring | numberThe flex shrink factor of the container.
paddingoptionalstring | number
paddingBottomoptionalstring | number
paddingHorizontaloptionalstring | number
paddingLeftoptionalstring | number
paddingRightoptionalstring | number
paddingTopoptionalstring | number
paddingVerticaloptionalstring | number
borderRadiusoptionalnumber
borderBottomLeftRadiusoptionalnumber
borderBottomRightRadiusoptionalnumber
borderTopLeftRadiusoptionalnumber
borderTopRightRadiusoptionalnumber
borderColoroptionalstring
borderBottomColoroptionalstring
borderLeftColoroptionalstring
borderRightColoroptionalstring
borderTopColoroptionalstring
borderStyleoptional'solid' | 'dotted' | 'dashed'
borderWidthoptionalstring | number
borderBottomWidthoptionalstring | number
borderLeftWidthoptionalstring | number
borderRightWidthoptionalstring | number
borderTopWidthoptionalstring | number
backgroundColoroptionalstring

<VStack>

A vertical stack

PropertyRequiredTypeComment
alignItemsoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'How to align children along the cross axis.
justifyContentoptional'center' | 'end' | 'start' | 'stretch' | 'space-around' | 'space-between' | 'space-evenly'How to align children within the main axis.
wrapoptionalbooleanWhat happens when children overflow along the main axis.
gapoptionalnumberThe size of the gaps (gutters) between rows and columns.
rowGapoptionalnumberThe size of the gap (gutter) between an element's rows.
columnGapoptionalnumberThe size of the gap (gutter) between an element's columns.
overflowoptional'hidden' | 'visible'Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction
alignSelfoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'Override alignment along the cross axis for this item.
widthoptionalstring | numberThe width of the container.
minWidthoptionalstring | numberThe minimum width of the container.
maxWidthoptionalstring | numberThe maximum width of the container.
heightoptionalstring | numberThe height of the container.
minHeightoptionalstring | numberThe minimum height of the container.
maxHeightoptionalstring | numberThe maximum height of the container.
basisoptionalstring | numberThe flex basis of the container.
growoptionalstring | numberThe flex grow factor of the container.
shrinkoptionalstring | numberThe flex shrink factor of the container.
paddingoptionalstring | number
paddingBottomoptionalstring | number
paddingHorizontaloptionalstring | number
paddingLeftoptionalstring | number
paddingRightoptionalstring | number
paddingTopoptionalstring | number
paddingVerticaloptionalstring | number
borderRadiusoptionalnumber
borderBottomLeftRadiusoptionalnumber
borderBottomRightRadiusoptionalnumber
borderTopLeftRadiusoptionalnumber
borderTopRightRadiusoptionalnumber
borderColoroptionalstring
borderBottomColoroptionalstring
borderLeftColoroptionalstring
borderRightColoroptionalstring
borderTopColoroptionalstring
borderStyleoptional'solid' | 'dotted' | 'dashed'
borderWidthoptionalstring | number
borderBottomWidthoptionalstring | number
borderLeftWidthoptionalstring | number
borderRightWidthoptionalstring | number
borderTopWidthoptionalstring | number
backgroundColoroptionalstring

<ZStack>

A stack with depth

PropertyRequiredTypeComment
alignoptional'center' | 'end' | 'start'How to align children along both axis.
alignHorizontaloptional'center' | 'end' | 'start'How to align children horizontally.
alignVerticaloptional'center' | 'end' | 'start'How to align children vertically.
overflowoptional'hidden' | 'visible'Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction
alignSelfoptional'baseline' | 'center' | 'end' | 'start' | 'stretch'Override alignment along the cross axis for this item.
widthoptionalstring | numberThe width of the container.
minWidthoptionalstring | numberThe minimum width of the container.
maxWidthoptionalstring | numberThe maximum width of the container.
heightoptionalstring | numberThe height of the container.
minHeightoptionalstring | numberThe minimum height of the container.
maxHeightoptionalstring | numberThe maximum height of the container.
basisoptionalstring | numberThe flex basis of the container.
growoptionalstring | numberThe flex grow factor of the container.
shrinkoptionalstring | numberThe flex shrink factor of the container.
paddingoptionalstring | number
paddingBottomoptionalstring | number
paddingHorizontaloptionalstring | number
paddingLeftoptionalstring | number
paddingRightoptionalstring | number
paddingTopoptionalstring | number
paddingVerticaloptionalstring | number
borderRadiusoptionalnumber
borderBottomLeftRadiusoptionalnumber
borderBottomRightRadiusoptionalnumber
borderTopLeftRadiusoptionalnumber
borderTopRightRadiusoptionalnumber
borderColoroptionalstring
borderBottomColoroptionalstring
borderLeftColoroptionalstring
borderRightColoroptionalstring
borderTopColoroptionalstring
borderStyleoptional'solid' | 'dotted' | 'dashed'
borderWidthoptionalstring | number
borderBottomWidthoptionalstring | number
borderLeftWidthoptionalstring | number
borderRightWidthoptionalstring | number
borderTopWidthoptionalstring | number
backgroundColoroptionalstring