Building blocks for robust cross-platform layouts.
npm install react-stackedBuilding 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:
- React (react-dom)
- React Native (react-native or expo)
``sh`
npm install --save react-stacked
`js
const { HStack, Text, VStack } = require('react-stacked')
const React = require('react')
const { render } = require('react-dom')
const Example = () => (
)
render(
`
`text
Left Right
Center
`
An inline text span
Property | Required | Type
-------- | -------- | ----
color | optional | string'none' \| 'underline' \| 'line-through' \| 'underline line-through'
decorationLine | optional | string
family | optional | boolean
italic | optional | string \| number
size | optional | 'none' \| 'capitalize' \| 'uppercase' \| 'lowercase'
transform | optional | Array \| 'small-caps' \| 'oldstyle-nums' \| 'lining-nums' \| 'tabular-nums' \| 'proportional-nums' \| string
variant | optional | 'normal' \| 'bold' \| '100' \| '200' \| '300' \| '400' \| '500' \| '600' \| '700' \| '800' \| '900'
weight | optional |
A block of text
Property | Required | Type | Comment
-------- | -------- | ---- | -------
align | optional | 'left' \| 'right' \| 'center' \| 'justify' \| nullboolean
allowFontScaling | optional | | Specifies whether fonts should scale to respect Text Size accessibility settings on supported platforms.string
color | optional | 'none' \| 'underline' \| 'line-through' \| 'underline line-through'
decorationLine | optional | string
family | optional | boolean
italic | optional | number \| null
numberOfLines | optional | | Limit the text to the specified number of lines.number
rotate | optional | | Rotate the text by the specified degrees. The origin of the transformation follows the text alignment.string \| number
size | optional | 'none' \| 'capitalize' \| 'uppercase' \| 'lowercase'
transform | optional | Array \| 'small-caps' \| 'oldstyle-nums' \| 'lining-nums' \| 'tabular-nums' \| 'proportional-nums' \| string
variant | optional | 'normal' \| 'bold' \| '100' \| '200' \| '300' \| '400' \| '500' \| '600' \| '700' \| '800' \| '900'
weight | optional | 'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch'
alignSelf | optional | | Override alignment along the cross axis for this item.string \| number
width | optional | | The width of the container.string \| number
minWidth | optional | | The minimum width of the container.string \| number
maxWidth | optional | | The maximum width of the container.string \| number
height | optional | | The height of the container.string \| number
minHeight | optional | | The minimum height of the container.string \| number
maxHeight | optional | | The maximum height of the container.string \| number
basis | optional | | The flex basis of the container.string \| number
grow | optional | | The flex grow factor of the container.string \| number
shrink | optional | | The flex shrink factor of the container.string \| number
padding | optional | string \| number
paddingBottom | optional | string \| number
paddingHorizontal | optional | string \| number
paddingLeft | optional | string \| number
paddingRight | optional | string \| number
paddingTop | optional | string \| number
paddingVertical | optional | number
borderRadius | optional | number
borderBottomLeftRadius | optional | number
borderBottomRightRadius | optional | number
borderTopLeftRadius | optional | number
borderTopRightRadius | optional | string
borderColor | optional | string
borderBottomColor | optional | string
borderLeftColor | optional | string
borderRightColor | optional | string
borderTopColor | optional | 'solid' \| 'dotted' \| 'dashed'
borderStyle | optional | string \| number
borderWidth | optional | string \| number
borderBottomWidth | optional | string \| number
borderLeftWidth | optional | string \| number
borderRightWidth | optional | string \| number
borderTopWidth | optional | string
backgroundColor | optional |
A horizontal stack
Property | Required | Type | Comment
-------- | -------- | ---- | -------
alignItems | optional | 'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch' | How to align children along the cross axis.'center' \| 'end' \| 'start' \| 'stretch' \| 'space-around' \| 'space-between' \| 'space-evenly'
justifyContent | optional | | How to align children within the main axis.boolean
wrap | optional | | What happens when children overflow along the main axis.number
gap | optional | | The size of the gaps (gutters) between rows and columns.number
rowGap | optional | | The size of the gap (gutter) between an element's rows.number
columnGap | optional | | The size of the gap (gutter) between an element's columns.'hidden' \| 'visible'
overflow | optional | | Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch'
alignSelf | optional | | Override alignment along the cross axis for this item.string \| number
width | optional | | The width of the container.string \| number
minWidth | optional | | The minimum width of the container.string \| number
maxWidth | optional | | The maximum width of the container.string \| number
height | optional | | The height of the container.string \| number
minHeight | optional | | The minimum height of the container.string \| number
maxHeight | optional | | The maximum height of the container.string \| number
basis | optional | | The flex basis of the container.string \| number
grow | optional | | The flex grow factor of the container.string \| number
shrink | optional | | The flex shrink factor of the container.string \| number
padding | optional | string \| number
paddingBottom | optional | string \| number
paddingHorizontal | optional | string \| number
paddingLeft | optional | string \| number
paddingRight | optional | string \| number
paddingTop | optional | string \| number
paddingVertical | optional | number
borderRadius | optional | number
borderBottomLeftRadius | optional | number
borderBottomRightRadius | optional | number
borderTopLeftRadius | optional | number
borderTopRightRadius | optional | string
borderColor | optional | string
borderBottomColor | optional | string
borderLeftColor | optional | string
borderRightColor | optional | string
borderTopColor | optional | 'solid' \| 'dotted' \| 'dashed'
borderStyle | optional | string \| number
borderWidth | optional | string \| number
borderBottomWidth | optional | string \| number
borderLeftWidth | optional | string \| number
borderRightWidth | optional | string \| number
borderTopWidth | optional | string
backgroundColor | optional |
A vertical stack
Property | Required | Type | Comment
-------- | -------- | ---- | -------
alignItems | optional | 'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch' | How to align children along the cross axis.'center' \| 'end' \| 'start' \| 'stretch' \| 'space-around' \| 'space-between' \| 'space-evenly'
justifyContent | optional | | How to align children within the main axis.boolean
wrap | optional | | What happens when children overflow along the main axis.number
gap | optional | | The size of the gaps (gutters) between rows and columns.number
rowGap | optional | | The size of the gap (gutter) between an element's rows.number
columnGap | optional | | The size of the gap (gutter) between an element's columns.'hidden' \| 'visible'
overflow | optional | | Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch'
alignSelf | optional | | Override alignment along the cross axis for this item.string \| number
width | optional | | The width of the container.string \| number
minWidth | optional | | The minimum width of the container.string \| number
maxWidth | optional | | The maximum width of the container.string \| number
height | optional | | The height of the container.string \| number
minHeight | optional | | The minimum height of the container.string \| number
maxHeight | optional | | The maximum height of the container.string \| number
basis | optional | | The flex basis of the container.string \| number
grow | optional | | The flex grow factor of the container.string \| number
shrink | optional | | The flex shrink factor of the container.string \| number
padding | optional | string \| number
paddingBottom | optional | string \| number
paddingHorizontal | optional | string \| number
paddingLeft | optional | string \| number
paddingRight | optional | string \| number
paddingTop | optional | string \| number
paddingVertical | optional | number
borderRadius | optional | number
borderBottomLeftRadius | optional | number
borderBottomRightRadius | optional | number
borderTopLeftRadius | optional | number
borderTopRightRadius | optional | string
borderColor | optional | string
borderBottomColor | optional | string
borderLeftColor | optional | string
borderRightColor | optional | string
borderTopColor | optional | 'solid' \| 'dotted' \| 'dashed'
borderStyle | optional | string \| number
borderWidth | optional | string \| number
borderBottomWidth | optional | string \| number
borderLeftWidth | optional | string \| number
borderRightWidth | optional | string \| number
borderTopWidth | optional | string
backgroundColor | optional |
A stack with depth
Property | Required | Type | Comment
-------- | -------- | ---- | -------
align | optional | 'center' \| 'end' \| 'start' | How to align children along both axis.'center' \| 'end' \| 'start'
alignHorizontal | optional | | How to align children horizontally.'center' \| 'end' \| 'start'
alignVertical | optional | | How to align children vertically.'hidden' \| 'visible'
overflow | optional | | Set the desired behavior when content does not fit in the element's padding box (overflows) in the horizontal and/or vertical direction'baseline' \| 'center' \| 'end' \| 'start' \| 'stretch'
alignSelf | optional | | Override alignment along the cross axis for this item.string \| number
width | optional | | The width of the container.string \| number
minWidth | optional | | The minimum width of the container.string \| number
maxWidth | optional | | The maximum width of the container.string \| number
height | optional | | The height of the container.string \| number
minHeight | optional | | The minimum height of the container.string \| number
maxHeight | optional | | The maximum height of the container.string \| number
basis | optional | | The flex basis of the container.string \| number
grow | optional | | The flex grow factor of the container.string \| number
shrink | optional | | The flex shrink factor of the container.string \| number
padding | optional | string \| number
paddingBottom | optional | string \| number
paddingHorizontal | optional | string \| number
paddingLeft | optional | string \| number
paddingRight | optional | string \| number
paddingTop | optional | string \| number
paddingVertical | optional | number
borderRadius | optional | number
borderBottomLeftRadius | optional | number
borderBottomRightRadius | optional | number
borderTopLeftRadius | optional | number
borderTopRightRadius | optional | string
borderColor | optional | string
borderBottomColor | optional | string
borderLeftColor | optional | string
borderRightColor | optional | string
borderTopColor | optional | 'solid' \| 'dotted' \| 'dashed'
borderStyle | optional | string \| number
borderWidth | optional | string \| number
borderBottomWidth | optional | string \| number
borderLeftWidth | optional | string \| number
borderRightWidth | optional | string \| number
borderTopWidth | optional | string`
backgroundColor | optional |