RNUI

UI Components Library for React Native

README


Check out our [Docs](https://wix.github.io/react-native-ui-lib/).

Download our Expo demo app

(You will need the Expo App)
or open link in your devices

Installing


See setup instructions here.

New Major Version 6.0



For React Native >= 0.60.0


please use react-native-ui-lib

For React Native < 0.60.0


please use react-native-ui-lib@^3.0.0

Create your own Design System in 3 easy steps


Step 1


Load your foundations and presets (colors, typography, spacings, etc...)

  1. ```js
  2. // FoundationConfig.js

  3. import {Colors, Typography, Spacings} from 'react-native-ui-lib';

  4. Colors.loadColors({
  5.   primaryColor: '#2364AA',
  6.   secondaryColor: '#81C3D7',
  7.   textColor: '##221D23',
  8.   errorColor: '#E63B2E',
  9.   successColor: '#ADC76F',
  10.   warnColor: '##FF963C'
  11. });

  12. Typography.loadTypographies({
  13.   heading: {fontSize: 36, fontWeight: '600'},
  14.   subheading: {fontSize: 28, fontWeight: '500'},
  15.   body: {fontSize: 18, fontWeight: '400'}
  16. });

  17. Spacings.loadSpacings({
  18.   page: 20,
  19.   card: 12,
  20.   gridGutter: 16
  21. });
  22. ```

Step 2


Set default configurations to your components

  1. ```js
  2. // ComponentsConfig.js

  3. import {ThemeManager} from 'react-native-ui-lib';

  4. // with plain object
  5. ThemeManager.setComponentTheme('Card', {
  6.   borderRadius: 8
  7. });

  8. // with a dynamic function
  9. ThemeManager.setComponentTheme('Button', (props, context) => {
  10.   // 'square' is not an original Button prop, but a custom prop that can
  11.   // be used to create different variations of buttons in your app
  12.   if (props.square) {
  13.     return {
  14.       borderRadius: 0
  15.     };
  16.   }
  17. });
  18. ```

Step 3


Use it all together.
Your configurations will be applied on uilib components so you can use them easily with modifiers.

  1. ```jsx
  2. // MyScreen.js

  3. import React, {Component} from 'react';
  4. import {View, Text, Card, Button} from 'react-native-ui-lib';

  5. class MyScreen extends Component {
  6.   render() {
  7.     return (
  8.       <View flex padding-page>
  9.         <Text heading marginB-s4>
  10.           My Screen
  11.         </Text>
  12.         <Card height={100} center padding-card marginB-s4>
  13.           <Text body>This is an example card </Text>
  14.         </Card>

  15.         <Button label="Button" body bg-primaryColor square></Button>
  16.       </View>
  17.     );
  18.   }
  19. }
  20. ```

Contributing