0.3.6 • Published 2 months ago

react-stacked v0.3.6

Weekly downloads
18
License
MIT
Repository
github
Last release
2 months ago

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:

  • React (react-dom)
  • React Native (react-native or expo)

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'
sizeoptionalstring \| number
transformoptional'none' \| 'capitalize' \| 'uppercase' \| 'lowercase'
weightoptional'normal' \| 'bold' \| '100' \| '200' \| '300' \| '400' \| '500' \| '600' \| '700' \| '800' \| '900'
childrenoptionalReact.ReactNode

<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'
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'
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
childrenoptionalReact.ReactNode

<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.
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
childrenoptionalReact.ReactNode

<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.
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
childrenoptionalReact.ReactNode

<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.
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
childrenoptionalReact.ReactNode
0.3.6

2 months ago

0.3.5

6 months ago

0.3.4

6 months ago

0.3.3

8 months ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago