2 | “The simplest scale is a single note, and sticking with a single note draws more attention to other parameters, such as rhythm and inflection.”
3 |
14 |
15 | ```
16 |
17 |
18 |
19 | Extends: [Box](/components/Box)
20 |
21 | prop | default | theme key
22 | ---|---|---
23 | position | absolute | N/A
24 | color | | colors
25 | bg | black | colors
26 | width | 320 | N/A
27 | zIndex | | N/A
28 | height | | heights
--------------------------------------------------------------------------------
/docs/components/Flex.md:
--------------------------------------------------------------------------------
1 | # Flex
2 |
3 | ```.jsx
4 |
7 |
8 | Flex
9 |
10 |
11 | Box
12 |
13 |
14 |
15 | ```
16 |
17 |
18 |
19 | Extends: [Box](/components/Box)
20 |
21 | prop | default | theme key
22 | ---|---|---
23 | flexWrap | | N/A
24 | flexDirection | | N/A
25 | alignItems | | N/A
26 | justifyContent | | N/A
--------------------------------------------------------------------------------
/docs/components/Close.md:
--------------------------------------------------------------------------------
1 | # Close
2 |
3 | ```.jsx
4 |
5 |
6 | ```
7 |
8 |
9 |
10 | Extends: [ButtonTransparent](/components/ButtonTransparent) > [Button](/components/Button) > [Box](/components/Box)
11 |
12 | prop | default | theme key
13 | ---|---|---
14 | m | | space
15 | mt | | space
16 | mr | | space
17 | mb | | space
18 | ml | | space
19 | mx | | space
20 | my | | space
21 | p | | space
22 | pt | | space
23 | pr | | space
24 | pb | | space
25 | pl | | space
26 | px | 3 | space
27 | py | 2 | space
--------------------------------------------------------------------------------
/docs/components/Progress.md:
--------------------------------------------------------------------------------
1 | # Progress
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | prop | default | theme key
13 | ---|---|---
14 | width | 1 | N/A
15 | m | | space
16 | mt | | space
17 | mr | | space
18 | mb | | space
19 | ml | | space
20 | mx | | space
21 | my | | space
22 | p | | space
23 | pt | | space
24 | pr | | space
25 | pb | | space
26 | pl | | space
27 | px | | space
28 | py | | space
29 | color | | colors
30 | bg | gray | colors
31 | borderRadius | 2 | radii
--------------------------------------------------------------------------------
/docs/components/Tab.md:
--------------------------------------------------------------------------------
1 | # Tab
2 |
3 | ```.jsx
4 |
5 | Hello
6 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [TabHelper](/components/TabHelper)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | m | | space
17 | mt | | space
18 | mr | 3 | space
19 | mb | | space
20 | ml | | space
21 | mx | | space
22 | my | | space
23 | p | | space
24 | pt | | space
25 | pr | | space
26 | pb | | space
27 | pl | | space
28 | px | | space
29 | py | 2 | space
30 | borderColor | transparent | colors
--------------------------------------------------------------------------------
/docs/components/Container.md:
--------------------------------------------------------------------------------
1 | # Container
2 |
3 | ```.jsx
4 |
5 | Hello
6 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [Box](/components/Box) > [Box](/components/Box)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | m | | space
17 | mt | | space
18 | mr | | space
19 | mb | | space
20 | ml | | space
21 | mx | auto | space
22 | my | | space
23 | p | | space
24 | pt | | space
25 | pr | | space
26 | pb | | space
27 | pl | | space
28 | px | 3 | space
29 | py | | space
30 | maxWidth | 1024 | maxWidths
--------------------------------------------------------------------------------
/docs/components/Pre.md:
--------------------------------------------------------------------------------
1 | # Pre
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | prop | default | theme key
13 | ---|---|---
14 | fontSize | 1 | fontSizes
15 | fontFamily | monospace | fonts
16 | m | | space
17 | mt | | space
18 | mr | | space
19 | mb | | space
20 | ml | | space
21 | mx | | space
22 | my | | space
23 | p | | space
24 | pt | | space
25 | pr | | space
26 | pb | | space
27 | pl | | space
28 | px | | space
29 | py | | space
30 | color | | colors
31 | bg | | colors
--------------------------------------------------------------------------------
/docs/components/Measure.md:
--------------------------------------------------------------------------------
1 | # Measure
2 |
3 | ```.jsx
4 |
5 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
6 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [MeasureHelper](/components/MeasureHelper)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | maxWidth | 256 | maxWidths
--------------------------------------------------------------------------------
/src/ButtonOutline.js:
--------------------------------------------------------------------------------
1 | import sys from 'native-system-components'
2 | import { themeGet } from 'styled-system'
3 | import Button from './Button'
4 |
5 | export const ButtonOutline = sys({
6 | is: Button,
7 | bg: 'transparent',
8 | textProps: {
9 | color: 'black'
10 | }
11 | }, props => ({
12 | borderWidth: 2,
13 | borderColor: themeGet('colors.' + props.textProps.color, props.textProps.color)(props),
14 | borderStyle: 'solid'
15 | }))
16 |
17 | ButtonOutline.displayName = 'ButtonOutline'
18 |
19 | export default ButtonOutline
20 |
--------------------------------------------------------------------------------
/docs/components/ButtonCircle.md:
--------------------------------------------------------------------------------
1 | # ButtonCircle
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [Button](/components/Button) > [Box](/components/Box)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | m | | space
17 | mt | | space
18 | mr | | space
19 | mb | | space
20 | ml | | space
21 | mx | | space
22 | my | | space
23 | p | | space
24 | pt | | space
25 | pr | | space
26 | pb | | space
27 | pl | | space
28 | px | 3 | space
29 | py | 2 | space
30 | borderRadius | 9999 | radii
--------------------------------------------------------------------------------
/docs/components/Row.md:
--------------------------------------------------------------------------------
1 | # Row
2 |
3 | ```.jsx
4 |
5 | Column
6 | Column
7 |
8 |
9 | ```
10 |
11 |
12 |
13 | Extends: [Flex](/components/Flex) > [Box](/components/Box)
14 |
15 | prop | default | theme key
16 | ---|---|---
17 | flexDirection | row | N/A
18 | m | | space
19 | mt | | space
20 | mr | | space
21 | mb | | space
22 | ml | | space
23 | mx | -3 | space
24 | my | | space
25 | p | | space
26 | pt | | space
27 | pr | | space
28 | pb | | space
29 | pl | | space
30 | px | | space
31 | py | | space
--------------------------------------------------------------------------------
/src/Card.js:
--------------------------------------------------------------------------------
1 | import sys from 'native-system-components'
2 | import {Platform} from 'react-primitives'
3 |
4 | const shadow = {
5 | ios: {
6 | shadowColor: '#000',
7 | shadowOffset: { width: 0, height: 2 },
8 | shadowOpacity: 0.2
9 | },
10 | android: {
11 | elevation: 2
12 | },
13 | web: {
14 | boxShadow: 2
15 | }
16 | }[Platform.OS] || {}
17 | export const Card = sys({
18 | p: 2,
19 | bg: 'white',
20 | borderRadius: 2,
21 | ...shadow
22 | }, 'space', 'color')
23 |
24 | Card.displayName = 'Card'
25 |
26 | export default Card
27 |
--------------------------------------------------------------------------------
/docs/components/Divider.md:
--------------------------------------------------------------------------------
1 | # Divider
2 |
3 | ```.jsx
4 |
8 |
9 | ```
10 |
11 |
12 |
13 | Extends: [Box](/components/Box) > [Box](/components/Box)
14 |
15 | prop | default | theme key
16 | ---|---|---
17 | m | | space
18 | mt | | space
19 | mr | | space
20 | mb | | space
21 | ml | | space
22 | mx | | space
23 | my | 3 | space
24 | p | | space
25 | pt | | space
26 | pr | | space
27 | pb | | space
28 | pl | | space
29 | px | | space
30 | py | | space
31 | borderColor | gray | colors
32 | color | | colors
33 | bg | | colors
--------------------------------------------------------------------------------
/docs/components/Column.md:
--------------------------------------------------------------------------------
1 | # Column
2 |
3 | ```.jsx
4 |
5 | Column
6 | Column
7 | Column
8 |
9 |
10 | ```
11 |
12 |
13 |
14 | Extends: [Box](/components/Box) > [Box](/components/Box)
15 |
16 | prop | default | theme key
17 | ---|---|---
18 | m | | space
19 | mt | | space
20 | mr | | space
21 | mb | 4 | space
22 | ml | | space
23 | mx | | space
24 | my | | space
25 | p | | space
26 | pt | | space
27 | pr | | space
28 | pb | | space
29 | pl | | space
30 | px | 3 | space
31 | py | | space
32 | flex | 1 1 auto | N/A
--------------------------------------------------------------------------------
/docs/components/Label.md:
--------------------------------------------------------------------------------
1 | # Label
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [Text](/components/Text) > [Text](/components/Text)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | fontSize | 1 | fontSizes
17 | m | | space
18 | mt | | space
19 | mr | | space
20 | mb | 1 | space
21 | ml | | space
22 | mx | | space
23 | my | | space
24 | p | | space
25 | pt | | space
26 | pr | | space
27 | pb | | space
28 | pl | | space
29 | px | | space
30 | py | | space
31 | alignItems | | N/A
32 | color | | colors
33 | bg | | colors
--------------------------------------------------------------------------------
/docs/components/Border.md:
--------------------------------------------------------------------------------
1 | # Border
2 |
3 | ```.jsx
4 |
6 | Hello
7 |
8 |
9 | ```
10 |
11 |
12 |
13 | Extends: [Box](/components/Box) > [Box](/components/Box)
14 |
15 | prop | default | theme key
16 | ---|---|---
17 | borderColor | gray | colors
18 | m | | space
19 | mt | | space
20 | mr | | space
21 | mb | | space
22 | ml | | space
23 | mx | | space
24 | my | | space
25 | p | | space
26 | pt | | space
27 | pr | | space
28 | pb | | space
29 | pl | | space
30 | px | | space
31 | py | | space
32 | width | | N/A
33 | color | | colors
34 | bg | | colors
--------------------------------------------------------------------------------
/docs/components/Code.md:
--------------------------------------------------------------------------------
1 | # Code
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [Text](/components/Text) > [Text](/components/Text)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | fontSize | 1 | fontSizes
17 | fontFamily | monospace | fonts
18 | m | | space
19 | mt | | space
20 | mr | | space
21 | mb | | space
22 | ml | | space
23 | mx | | space
24 | my | | space
25 | p | | space
26 | pt | | space
27 | pr | | space
28 | pb | | space
29 | pl | | space
30 | px | | space
31 | py | | space
32 | color | | colors
33 | bg | | colors
--------------------------------------------------------------------------------
/docs/components/Badge.md:
--------------------------------------------------------------------------------
1 | # Badge
2 |
3 | ```.jsx
4 |
5 | Hello
6 |
7 | Beep
8 |
9 |
10 |
11 | ```
12 |
13 |
14 |
15 | Extends: [Box](/components/Box) > [Box](/components/Box)
16 |
17 | prop | default | theme key
18 | ---|---|---
19 | m | | space
20 | mt | | space
21 | mr | | space
22 | mb | | space
23 | ml | | space
24 | mx | 1 | space
25 | my | | space
26 | p | | space
27 | pt | | space
28 | pr | | space
29 | pb | | space
30 | pl | | space
31 | px | 2 | space
32 | py | 1 | space
33 | color | | colors
34 | bg | blue | colors
35 | borderRadius | 2 | radii
--------------------------------------------------------------------------------
/examples/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "empty-project-template",
3 | "main": "node_modules/expo/AppEntry.js",
4 | "private": true,
5 | "scripts": {
6 | "start": "expo start",
7 | "android": "expo start --android",
8 | "ios": "expo start --ios",
9 | "eject": "expo eject"
10 | },
11 | "dependencies": {
12 | "exp": "^57.0.0",
13 | "expo": "^29.0.0",
14 | "react": "16.3.1",
15 | "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
16 | "react-navigation": "^2.12.1",
17 | "rebass-native": "latest",
18 | "styled-components": "^3.4.5"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/docs/components/Message.md:
--------------------------------------------------------------------------------
1 | # Message
2 |
3 | ```.jsx
4 |
5 | Hello
6 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [MessageHelper](/components/MessageHelper)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | m | | space
17 | mt | | space
18 | mr | | space
19 | mb | | space
20 | ml | | space
21 | mx | | space
22 | my | | space
23 | p | | space
24 | pt | | space
25 | pr | | space
26 | pb | | space
27 | pl | | space
28 | px | 3 | space
29 | py | 2 | space
30 | color | | colors
31 | bg | blue | colors
32 | flexDirection | row | N/A
33 | alignItems | center | N/A
34 | minHeight | 48px | minHeights
--------------------------------------------------------------------------------
/src/Measure.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import sys from 'native-system-components'
3 | import {Box, Text} from './'
4 |
5 | class MeasureHelper extends React.Component {
6 | render () {
7 | const {children, textProps = {}, ...props} = this.props
8 | return (
9 |
10 | {typeof children === 'string'
11 | ? {children} : children}
12 |
13 | )
14 | }
15 | }
16 |
17 | export const Measure = sys({
18 | is: MeasureHelper,
19 | maxWidth: 256
20 | }, 'maxWidth')
21 |
22 | Measure.displayName = 'Measure'
23 |
24 | export default Measure
25 |
--------------------------------------------------------------------------------
/src/Banner.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import sys from 'native-system-components'
3 | import { Flex, Text } from './'
4 |
5 | export const Banner = sys({
6 | is: Flex,
7 | p: 3,
8 | flexDirection: 'column',
9 | alignItems: 'center',
10 | justifyContent: 'center',
11 | // backgroundSize: 'cover',
12 | // backgroundPosition: 'center',
13 | minHeight: 100,
14 | // color: 'white',
15 | bg: 'black',
16 | children: Banner
17 | },
18 | 'minHeight',
19 | 'backgroundSize',
20 | 'backgroundPosition',
21 | 'backgroundImage'
22 | )
23 |
24 | Banner.displayName = 'Banner'
25 |
26 | export default Banner
27 |
--------------------------------------------------------------------------------
/src/Dot.js:
--------------------------------------------------------------------------------
1 | import sys from 'native-system-components'
2 |
3 | export const Dot = sys({
4 | // is: 'button',
5 | m: 0,
6 | p: 0,
7 | size: 16,
8 | bg: 'grey',
9 | borderRadius: 99999,
10 | border: 4,
11 | borderColor: 'transparent'
12 | // focus: {
13 | // backgroundColor: 'blue'
14 | // },
15 | // hover: {
16 | // backgroundColor: 'blue'
17 | // },
18 | // disabledStyle: {
19 | // opacity: 1/4
20 | // }
21 | // }, {
22 | // appearance: 'none',
23 | // backgroundClip: 'padding-box'
24 | },
25 | 'size',
26 | 'space',
27 | 'color'
28 | )
29 |
30 | Dot.displayName = 'Dot'
31 |
32 | export default Dot
33 |
--------------------------------------------------------------------------------
/src/Position.js:
--------------------------------------------------------------------------------
1 | import sys from 'native-system-components'
2 | import {Platform} from 'react-primitives'
3 | import {Box} from './'
4 | export const Position = sys({
5 | is: Box
6 | }, 'space', 'color', 'zIndex', 'top', 'right', 'bottom', 'left'
7 | )
8 |
9 | Position.displayName = 'Position'
10 |
11 | export const Absolute = sys({
12 | is: Position
13 | }, {
14 | position: 'absolute'
15 | })
16 | Absolute.displayName = 'Absolute'
17 |
18 | export const Relative = sys({
19 | is: Position
20 | }, Platform.OS === 'web' ? {
21 | position: 'relative'
22 | } : {})
23 | Relative.displayName = 'Relative'
24 |
25 | export default Position
26 |
--------------------------------------------------------------------------------
/src/Provider.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { ThemeProvider } from 'styled-components'
3 | import { View } from 'react-primitives'
4 | import defaultTheme from './theme'
5 |
6 | export class Provider extends React.Component {
7 | render () {
8 | const {
9 | theme,
10 | ...props
11 | } = this.props
12 |
13 | return (
14 |
15 |
16 |
17 | )
18 | }
19 | }
20 |
21 | Provider.defaultProps = {
22 | theme: {}
23 | }
24 |
25 | Provider.displayName = 'Rebass.Provider'
26 |
27 | export default Provider
28 |
--------------------------------------------------------------------------------
/docs/components/Heading.md:
--------------------------------------------------------------------------------
1 | # Heading
2 |
3 | ```.jsx
4 |
7 |
8 | ```
9 |
10 |
11 |
12 | Extends: [Text](/components/Text) > [Text](/components/Text)
13 |
14 | prop | default | theme key
15 | ---|---|---
16 | fontSize | 5 | fontSizes
17 | fontWeight | bold | fontWeights
18 | m | | space
19 | mt | | space
20 | mr | | space
21 | mb | | space
22 | ml | | space
23 | mx | | space
24 | my | | space
25 | p | | space
26 | pt | | space
27 | pr | | space
28 | pb | | space
29 | pl | | space
30 | px | | space
31 | py | | space
32 | fontFamily | | fonts
33 | color | | colors
34 | bg | | colors
35 | textAlign | | N/A
--------------------------------------------------------------------------------
/docs/components/Blockquote.md:
--------------------------------------------------------------------------------
1 | # Blockquote
2 |
3 | ```.jsx
4 |
5 | “The simplest scale is a single note, and sticking with a single note draws more attention to other parameters, such as rhythm and inflection.”
6 |
27 | The default theme in Rebass includes {keys.length} colors to help get you started.
28 | Theming can be completely customized using the Provider component.
29 |
39 | `}
40 |
41 | Inheritance
42 | {
43 | this.props.navigation.navigate('BoxScreen')
44 | }}>Box
45 |
46 | Props
47 |
48 |
49 |
50 | prop
51 |
52 |
53 | default
54 |
55 |
56 | theme key
57 |
58 |
59 |
60 | position
61 | absolute
62 | N/A
63 |
64 |
65 | color
66 |
67 | colors
68 |
69 |
70 | bg
71 | black
72 | colors
73 |
74 |
75 | width
76 | 320
77 | N/A
78 |
79 |
80 | zIndex
81 |
82 | N/A
83 |
84 |
85 | height
86 |
87 | heights
88 |
89 |
90 |
91 | )
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/examples/app/RootStack.js:
--------------------------------------------------------------------------------
1 |
2 | import { createStackNavigator } from 'react-navigation'
3 | import {IndexScreen} from './IndexScreen.js'
4 | import {FlexScreen} from './screens/FlexScreen.js'
5 | import {BoxScreen} from './screens/BoxScreen.js'
6 | import {ProviderScreen} from './screens/ProviderScreen.js'
7 | import {ButtonScreen} from './screens/ButtonScreen.js'
8 | import {ButtonOutlineScreen} from './screens/ButtonOutlineScreen.js'
9 | import {ButtonCircleScreen} from './screens/ButtonCircleScreen.js'
10 | import {ButtonTransparentScreen} from './screens/ButtonTransparentScreen.js'
11 | import {CloseScreen} from './screens/CloseScreen.js'
12 | import {TextScreen} from './screens/TextScreen.js'
13 | import {HeadingScreen} from './screens/HeadingScreen.js'
14 | import {SubheadScreen} from './screens/SubheadScreen.js'
15 | import {CapsScreen} from './screens/CapsScreen.js'
16 | import {SmallScreen} from './screens/SmallScreen.js'
17 | import {LeadScreen} from './screens/LeadScreen.js'
18 | import {TruncateScreen} from './screens/TruncateScreen.js'
19 | import {BlockquoteScreen} from './screens/BlockquoteScreen.js'
20 | import {PreScreen} from './screens/PreScreen.js'
21 | import {CodeScreen} from './screens/CodeScreen.js'
22 | import {MeasureScreen} from './screens/MeasureScreen.js'
23 | import {LabelScreen} from './screens/LabelScreen.js'
24 | import {DividerScreen} from './screens/DividerScreen.js'
25 | import {BorderScreen} from './screens/BorderScreen.js'
26 | import {ImageScreen} from './screens/ImageScreen.js'
27 | import {AvatarScreen} from './screens/AvatarScreen.js'
28 | import {ContainerScreen} from './screens/ContainerScreen.js'
29 | import {RowScreen} from './screens/RowScreen.js'
30 | import {ColumnScreen} from './screens/ColumnScreen.js'
31 | import {CardScreen} from './screens/CardScreen.js'
32 | import {PanelScreen} from './screens/PanelScreen.js'
33 | import {ProgressScreen} from './screens/ProgressScreen.js'
34 | import {BannerScreen} from './screens/BannerScreen.js'
35 | import {MessageScreen} from './screens/MessageScreen.js'
36 | import {TabsScreen} from './screens/TabsScreen.js'
37 | import {TabScreen} from './screens/TabScreen.js'
38 | import {BadgeScreen} from './screens/BadgeScreen.js'
39 | import {CircleScreen} from './screens/CircleScreen.js'
40 | import {DotScreen} from './screens/DotScreen.js'
41 | import {ArrowScreen} from './screens/ArrowScreen.js'
42 | import {PositionScreen} from './screens/PositionScreen.js'
43 | import {AbsoluteScreen} from './screens/AbsoluteScreen.js'
44 | import {RelativeScreen} from './screens/RelativeScreen.js'
45 | import {ModalScreen} from './screens/ModalScreen.js'
46 | import {DrawerScreen} from './screens/DrawerScreen.js'
47 | import {HideScreen} from './screens/HideScreen.js'
48 |
49 | export const RootStack = createStackNavigator(
50 | {
51 | IndexScreen,
52 | FlexScreen,
53 | BoxScreen,
54 | ProviderScreen,
55 | ButtonScreen,
56 | ButtonOutlineScreen,
57 | ButtonCircleScreen,
58 | ButtonTransparentScreen,
59 | CloseScreen,
60 | TextScreen,
61 | HeadingScreen,
62 | SubheadScreen,
63 | CapsScreen,
64 | SmallScreen,
65 | LeadScreen,
66 | TruncateScreen,
67 | BlockquoteScreen,
68 | PreScreen,
69 | CodeScreen,
70 | MeasureScreen,
71 | LabelScreen,
72 | DividerScreen,
73 | BorderScreen,
74 | ImageScreen,
75 | AvatarScreen,
76 | ContainerScreen,
77 | RowScreen,
78 | ColumnScreen,
79 | CardScreen,
80 | PanelScreen,
81 | ProgressScreen,
82 | BannerScreen,
83 | MessageScreen,
84 | TabsScreen,
85 | TabScreen,
86 | BadgeScreen,
87 | CircleScreen,
88 | DotScreen,
89 | ArrowScreen,
90 | PositionScreen,
91 | AbsoluteScreen,
92 | RelativeScreen,
93 | ModalScreen,
94 | DrawerScreen,
95 | HideScreen
96 | },
97 | {
98 | initialRouteName: 'IndexScreen'
99 | }
100 | )
101 |
--------------------------------------------------------------------------------
/docs/props.md:
--------------------------------------------------------------------------------
1 |
2 | # Props
3 |
4 | ## Styled System
5 |
6 | Rebass Native components use [styled-system][system] for responsive, theme-based style props.
7 |
8 | ## Margin and Padding
9 |
10 | All Rebass Native component use the [space][space] utility from [styled-system][system] to handle responsive margin and padding props based on a global spacing scale (`theme.space`).
11 | The margin and padding props help promote consistency in layout
12 | without the need to add custom margin and padding declarations throughout an application.
13 | The margin and padding props use a shorthand syntax, similar to other OOCSS approaches and many CSS libraries.
14 |
15 | ```.jsx
16 |
22 | Hello
23 |
24 | ```
25 |
26 | - `m`: margin
27 | - `mt`: margin-top
28 | - `mr`: margin-right
29 | - `mb`: margin-bottom
30 | - `ml`: margin-left
31 | - `mx`: margin-left and margin-right
32 | - `my`: margin-top and margin-bottom
33 | - `p` : padding
34 | - `pt`: padding-top
35 | - `pr`: padding-right
36 | - `pb`: padding-bottom
37 | - `pl`: padding-left
38 | - `px`: padding-left and padding-right
39 | - `py`: padding-top and padding-bottom
40 |
41 | ```jsx
42 | // Numbers reference steps on the spacing scale
43 | // e.g. 8px
44 |
45 |
46 | // Numbers greater than the length of `theme.space.length` are converted to pixels
47 |
48 |
49 | // Negative values can be used to add negative margins
50 |
51 |
52 | // Strings can be used for other values
53 |
54 |
55 | // Arrays can be used for mobile-first responsive styles
56 |
57 | ```
58 |
59 | ## Colors
60 |
61 | All Rebass Native components use [styled-system's][system] [color][color] function to add the `color` and `bg` props.
62 | The `color` and `bg` props make using colors from the color palette simple to help promote design consistency.
63 |
64 | The color values can be defined in the `theme.colors` object.
65 |
66 | ```.jsx
67 |
68 | Hello
69 |
70 | ```
71 |
72 | ```jsx
73 | // Keys reference values in the color palette object
74 |
75 |
76 | // Background color can be set with the `bg` prop
77 |
78 |
79 | // Values that do not map to a key in `theme.colors` can be used
80 |
81 |
82 | // Arrays can be used to change colors responsively
83 |
84 | ```
85 |
86 | ## Responsive Styles
87 |
88 | Many Rebass Native props accept arrays as values to set mobile-first responsive styles.
89 | The first value is not scoped to a media query and applies to all breakpoints.
90 | Each value after the first corresponds to a media query derived from `theme.breakpoints`.
91 |
92 | See the [styled-system][responsive] docs for more info.
93 |
94 | ```.jsx
95 |
96 |
101 | Hello
102 |
103 |
108 | Hello
109 |
110 |
111 | ```
112 |
113 | ```jsx
114 |
122 | ```
123 |
124 | ## Component-Specific Props
125 |
126 | Refer to the [component documentation](components.md) for information on component-specific props.
127 |
128 | [system]: https://github.com/jxnblk/styled-system
129 | [space]: https://github.com/jxnblk/styled-system/blob/master/docs/api.md#space-responsive
130 | [color]: https://github.com/jxnblk/styled-system/blob/master/docs/api.md#color-responsive
131 | [responsive]: https://github.com/jxnblk/styled-system/blob/master/docs/responsive-styles.md
132 | [system-components]: https://github.com/jxnblk/styled-system/tree/master/system-components
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Rebass-native
2 |
3 | Port of [Rebass](https://github.com/jxnblk/rebass) for react-native, a UI component library & design system,
4 | built with [styled-system][system],
5 | with support for
6 | [styled-components][sc].
7 |
8 | [![Build Status][badge]][travis]
9 | [![Coverage][coverage-badge]][coverage]
10 | [![Downloads][downloads-badge]][npm]
11 | [![Version][version-badge]][npm]
12 |
13 | [badge]: https://img.shields.io/travis/Hermanya/rebass-native.svg?style=flat-square
14 | [travis]: https://travis-ci.org/Hermanya/rebass-native
15 | [coverage-badge]: https://img.shields.io/codecov/c/github/hermanya/rebass-native.svg?style=flat-square
16 | [coverage]: https://codecov.io/github/hermanya/rebass-native
17 |
18 | [downloads-badge]: https://img.shields.io/npm/dw/rebass-native.svg?style=flat-square
19 | [version-badge]: https://img.shields.io/npm/v/rebass-native.svg?style=flat-square
20 | [npm]: https://npmjs.com/package/rebass-native
21 |
22 |
23 | ```sh
24 | npm i rebass-native
25 | ```
26 |
27 | [See Demo](https://snack.expo.io/@git/github.com/hermanya/rebass-native:examples/app)
28 |
29 | Rebass-native is a port of Rebass, a library of highly-composable, primitive UI components for React,
30 | built with styled-components to keep styles isolated and reduce the need to write custom Styles in your application.
31 | Based upon a configurable design system,
32 | Rebass‘s props API makes building consistent, responsive web apps simpler and faster.
33 |
34 |
35 | ## Getting Started
36 |
37 | ```jsx
38 | import React from 'react'
39 | import { Provider, Heading, Button } from 'rebass-native'
40 |
41 | const App = props => (
42 |
43 | Hello
44 |
45 |
46 | )
47 | ```
48 |
49 | ## Features
50 |
51 | - Kickstart your own react-native component library
52 | - Responsive style props from [styled-system][system]
53 | - Flexbox grid with [native-grid-styled][gs]
54 | - Support for [styled-components][sc]
55 | - Functional stateless UI components
56 | - Configurable theming
57 | - Extensible base components
58 | - Design-system based consistency
59 | - Built for responsive web design
60 |
61 | ## Documentation
62 |
63 | - [Docs](https://hermanya.github.io/rebass-native)
64 | - [Getting Started](https://hermanya.github.io/rebass-native/getting-started)
65 | - [Props](https://hermanya.github.io/rebass-native/props)
66 | - [Grid System](https://hermanya.github.io/rebass-native/grid-system)
67 | - [Theming](https://hermanya.github.io/rebass-native/theming)
68 | - [Extending](https://hermanya.github.io/rebass-native/extending)
69 | - [Components](https://hermanya.github.io/rebass-native/components)
70 |
71 | ## CodeSandbox
72 |
73 | Try it out:
74 |
75 | https://snack.expo.io/@git/github.com/hermanya/rebass-native:examples/app
76 |
77 | ### Architectural Approach
78 |
79 | Rebass is built around a component architectural approach inspired by Dan Abramov’s
80 | [Presentational and Container Components](https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.ah4312963),
81 | where presentational components are the only ones that encapsulate styles and contain no application logic,
82 | and container components do not contain any styles or DOM markup and handle all the application logic.
83 |
84 | Rebass only contains presentational components,
85 | which means controlling things like progressive disclosure mechanisms
86 | or dropdown menus should be handled at a higher level in container components.
87 | Therefore, Rebass itself does not require any client-side JavaScript,
88 | is well suited to server-side rendering,
89 | and can fit into virtually any higher level application architecture.
90 |
91 | See [Patterns for Style Composition in React](http://jxnblk.com/writing/posts/patterns-for-style-composition-in-react/)
92 | for more on some of the thought behind Rebass.
93 |
94 |
95 | ### Related
96 |
97 | - [styled-system][system]
98 | - [native-grid-styled][gs]
99 | - [styled-components][sc]
100 |
101 | [system]: https://github.com/jxnblk/styled-system
102 | [gs]: https://github.com/hermanya/native-grid-styled
103 | [sc]: https://github.com/styled-components/styled-components
104 |
105 | ---
106 |
107 | [Contributing](.github/CONTRIBUTING.md)
108 | |
109 | [MIT License](.github/LICENSE.md)
110 |
--------------------------------------------------------------------------------
/examples/app/screens/TabScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class TabScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Tab',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 | Hello
17 |
18 |
19 |
20 |
21 | Code
22 | {`
23 | Hello
24 |
25 | `}
26 |
27 | Inheritance
28 | {
29 | this.props.navigation.navigate('TabHelperScreen')
30 | }}>TabHelper
31 |
32 | Props
33 |
34 |
35 |
36 | prop
37 |
38 |
39 | default
40 |
41 |
42 | theme key
43 |
44 |
45 |
46 | m
47 |
48 | space
49 |
50 |
51 | mt
52 |
53 | space
54 |
55 |
56 | mr
57 | 3
58 | space
59 |
60 |
61 | mb
62 |
63 | space
64 |
65 |
66 | ml
67 |
68 | space
69 |
70 |
71 | mx
72 |
73 | space
74 |
75 |
76 | my
77 |
78 | space
79 |
80 |
81 | p
82 |
83 | space
84 |
85 |
86 | pt
87 |
88 | space
89 |
90 |
91 | pr
92 |
93 | space
94 |
95 |
96 | pb
97 |
98 | space
99 |
100 |
101 | pl
102 |
103 | space
104 |
105 |
106 | px
107 |
108 | space
109 |
110 |
111 | py
112 | 2
113 | space
114 |
115 |
116 | borderColor
117 | transparent
118 | colors
119 |
120 |
121 |
122 | )
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/examples/app/screens/ArrowScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class ArrowScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Arrow',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 |
17 |
18 |
19 | Code
20 | {`
21 | `}
22 |
23 | Inheritance
24 |
25 |
26 | Props
27 |
28 |
29 |
30 | prop
31 |
32 |
33 | default
34 |
35 |
36 | theme key
37 |
38 |
39 |
40 | m
41 |
42 | space
43 |
44 |
45 | mt
46 |
47 | space
48 |
49 |
50 | mr
51 |
52 | space
53 |
54 |
55 | mb
56 |
57 | space
58 |
59 |
60 | ml
61 |
62 | space
63 |
64 |
65 | mx
66 |
67 | space
68 |
69 |
70 | my
71 |
72 | space
73 |
74 |
75 | p
76 |
77 | space
78 |
79 |
80 | pt
81 |
82 | space
83 |
84 |
85 | pr
86 |
87 | space
88 |
89 |
90 | pb
91 |
92 | space
93 |
94 |
95 | pl
96 |
97 | space
98 |
99 |
100 | px
101 |
102 | space
103 |
104 |
105 | py
106 |
107 | space
108 |
109 |
110 | color
111 |
112 | colors
113 |
114 |
115 | bg
116 |
117 | colors
118 |
119 |
120 |
121 | )
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/examples/app/screens/CloseScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class CloseScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Close',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 |
17 |
18 |
19 | Code
20 | {`
21 | `}
22 |
23 | Inheritance
24 | {
25 | this.props.navigation.navigate('ButtonTransparentScreen')
26 | }}>ButtonTransparent → {
27 | this.props.navigation.navigate('ButtonScreen')
28 | }}>Button → {
29 | this.props.navigation.navigate('BoxScreen')
30 | }}>Box
31 |
32 | Props
33 |
34 |
35 |
36 | prop
37 |
38 |
39 | default
40 |
41 |
42 | theme key
43 |
44 |
45 |
46 | m
47 |
48 | space
49 |
50 |
51 | mt
52 |
53 | space
54 |
55 |
56 | mr
57 |
58 | space
59 |
60 |
61 | mb
62 |
63 | space
64 |
65 |
66 | ml
67 |
68 | space
69 |
70 |
71 | mx
72 |
73 | space
74 |
75 |
76 | my
77 |
78 | space
79 |
80 |
81 | p
82 |
83 | space
84 |
85 |
86 | pt
87 |
88 | space
89 |
90 |
91 | pr
92 |
93 | space
94 |
95 |
96 | pb
97 |
98 | space
99 |
100 |
101 | pl
102 |
103 | space
104 |
105 |
106 | px
107 | 3
108 | space
109 |
110 |
111 | py
112 | 2
113 | space
114 |
115 |
116 |
117 | )
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/examples/app/screens/ContainerScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class ContainerScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Container',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 | Hello
17 |
18 |
19 |
20 |
21 | Code
22 | {`
23 | Hello
24 |
25 | `}
26 |
27 | Inheritance
28 | {
29 | this.props.navigation.navigate('BoxScreen')
30 | }}>Box → {
31 | this.props.navigation.navigate('BoxScreen')
32 | }}>Box
33 |
34 | Props
35 |
36 |
37 |
38 | prop
39 |
40 |
41 | default
42 |
43 |
44 | theme key
45 |
46 |
47 |
48 | m
49 |
50 | space
51 |
52 |
53 | mt
54 |
55 | space
56 |
57 |
58 | mr
59 |
60 | space
61 |
62 |
63 | mb
64 |
65 | space
66 |
67 |
68 | ml
69 |
70 | space
71 |
72 |
73 | mx
74 | auto
75 | space
76 |
77 |
78 | my
79 |
80 | space
81 |
82 |
83 | p
84 |
85 | space
86 |
87 |
88 | pt
89 |
90 | space
91 |
92 |
93 | pr
94 |
95 | space
96 |
97 |
98 | pb
99 |
100 | space
101 |
102 |
103 | pl
104 |
105 | space
106 |
107 |
108 | px
109 | 3
110 | space
111 |
112 |
113 | py
114 |
115 | space
116 |
117 |
118 | maxWidth
119 | 1024
120 | maxWidths
121 |
122 |
123 |
124 | )
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/examples/app/screens/ButtonCircleScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class ButtonCircleScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'ButtonCircle',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
18 |
19 |
20 |
21 | Code
22 | {`
25 | `}
26 |
27 | Inheritance
28 | {
29 | this.props.navigation.navigate('ButtonScreen')
30 | }}>Button → {
31 | this.props.navigation.navigate('BoxScreen')
32 | }}>Box
33 |
34 | Props
35 |
36 |
37 |
38 | prop
39 |
40 |
41 | default
42 |
43 |
44 | theme key
45 |
46 |
47 |
48 | m
49 |
50 | space
51 |
52 |
53 | mt
54 |
55 | space
56 |
57 |
58 | mr
59 |
60 | space
61 |
62 |
63 | mb
64 |
65 | space
66 |
67 |
68 | ml
69 |
70 | space
71 |
72 |
73 | mx
74 |
75 | space
76 |
77 |
78 | my
79 |
80 | space
81 |
82 |
83 | p
84 |
85 | space
86 |
87 |
88 | pt
89 |
90 | space
91 |
92 |
93 | pr
94 |
95 | space
96 |
97 |
98 | pb
99 |
100 | space
101 |
102 |
103 | pl
104 |
105 | space
106 |
107 |
108 | px
109 | 3
110 | space
111 |
112 |
113 | py
114 | 2
115 | space
116 |
117 |
118 | borderRadius
119 | 9999
120 | radii
121 |
122 |
123 |
124 | )
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/examples/app/screens/RowScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class RowScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Row',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 | Column
17 | Column
18 |
19 |
20 |
21 |
22 | Code
23 | {`
24 | Column
25 | Column
26 |
27 | `}
28 |
29 | Inheritance
30 | {
31 | this.props.navigation.navigate('FlexScreen')
32 | }}>Flex → {
33 | this.props.navigation.navigate('BoxScreen')
34 | }}>Box
35 |
36 | Props
37 |
38 |
39 |
40 | prop
41 |
42 |
43 | default
44 |
45 |
46 | theme key
47 |
48 |
49 |
50 | flexDirection
51 | row
52 | N/A
53 |
54 |
55 | m
56 |
57 | space
58 |
59 |
60 | mt
61 |
62 | space
63 |
64 |
65 | mr
66 |
67 | space
68 |
69 |
70 | mb
71 |
72 | space
73 |
74 |
75 | ml
76 |
77 | space
78 |
79 |
80 | mx
81 | -3
82 | space
83 |
84 |
85 | my
86 |
87 | space
88 |
89 |
90 | p
91 |
92 | space
93 |
94 |
95 | pt
96 |
97 | space
98 |
99 |
100 | pr
101 |
102 | space
103 |
104 |
105 | pb
106 |
107 | space
108 |
109 |
110 | pl
111 |
112 | space
113 |
114 |
115 | px
116 |
117 | space
118 |
119 |
120 | py
121 |
122 | space
123 |
124 |
125 |
126 | )
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/examples/app/screens/ColumnScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class ColumnScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Column',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 | Column
17 | Column
18 | Column
19 |
20 |
21 |
22 |
23 | Code
24 | {`
25 | Column
26 | Column
27 | Column
28 |
29 | `}
30 |
31 | Inheritance
32 | {
33 | this.props.navigation.navigate('BoxScreen')
34 | }}>Box → {
35 | this.props.navigation.navigate('BoxScreen')
36 | }}>Box
37 |
38 | Props
39 |
40 |
41 |
42 | prop
43 |
44 |
45 | default
46 |
47 |
48 | theme key
49 |
50 |
51 |
52 | m
53 |
54 | space
55 |
56 |
57 | mt
58 |
59 | space
60 |
61 |
62 | mr
63 |
64 | space
65 |
66 |
67 | mb
68 | 4
69 | space
70 |
71 |
72 | ml
73 |
74 | space
75 |
76 |
77 | mx
78 |
79 | space
80 |
81 |
82 | my
83 |
84 | space
85 |
86 |
87 | p
88 |
89 | space
90 |
91 |
92 | pt
93 |
94 | space
95 |
96 |
97 | pr
98 |
99 | space
100 |
101 |
102 | pb
103 |
104 | space
105 |
106 |
107 | pl
108 |
109 | space
110 |
111 |
112 | px
113 | 3
114 | space
115 |
116 |
117 | py
118 |
119 | space
120 |
121 |
122 | flex
123 | 1 1 auto
124 | N/A
125 |
126 |
127 |
128 | )
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/examples/app/screens/BlockquoteScreen.js:
--------------------------------------------------------------------------------
1 |
2 | import React from 'react';
3 | import {ScrollView} from 'react-native'
4 | import * as RebassNative from 'rebass-native'
5 |
6 | export class BlockquoteScreen extends React.Component {
7 | static navigationOptions = {
8 | title: 'Blockquote',
9 | };
10 | render () {
11 | return (
12 |
13 | Demo
14 |
15 |
16 | “The simplest scale is a single note, and sticking with a single note draws more attention to other parameters, such as rhythm and inflection.”
17 |
18 |
19 |
20 |
21 | Code
22 | {`
23 | “The simplest scale is a single note, and sticking with a single note draws more attention to other parameters, such as rhythm and inflection.”
24 |