Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

react-native-material-kit

> 前端框架
Open source

Bringing Material Design to React Native

4.8K stars0 likes0 views
WebsiteGitHub

About

Bringing Material Design to React Native

Build Status npm react-native MIT

A set of UI components, in the purpose of introducing Material Design to apps built with React Native, quickly and painlessly.

Getting Started

First, cd to your RN project directory, and install RNMK through rnpm . If you don't have rnpm, you can install RNMK from npm with the command npm i -S react-native-material-kit and link it manually (see below).

NOTICE:

react-native-material-kit >= 0.4.0 only supports react-native >= 0.40.0

react-native-material-kit < 0.4.0 only supports react-native < 0.40.0

iOS

  • React Native < 0.29 (Using rnpm)

    rnpm install react-native-material-kit

  • React Native >= 0.29

    npm install -S react-native-material-kit

    react-native link react-native-material-kit

Manually

  1. Add node_modules/react-native-material-kit/iOS/RCTMaterialKit.xcodeproj to your xcode project, usually under the Libraries group
  2. Add libRCTMaterialKit.a (from Products under RCTMaterialKit.xcodeproj) to build target's Linked Frameworks and Libraries list

Option: Using CocoaPods

Assuming you have CocoaPods installed, create a PodFile like this in your app's project directory. You can leave out the modules you don't need.

…

Now run pod install. This will create an Xcode workspace containing all necessary native files, including react-native-material-kit. From now on open YourProject.xcworkspace instead of YourProject.xcodeproject in Xcode. Because React Native's iOS code is now pulled in via CocoaPods, you also need to remove the React, RCTImage, etc. subprojects from your app's Xcode project, in case they were added previously.

Android

  • React Native < 0.29 (Using rnpm)

    rnpm install react-native-material-kit

  • React Native >= 0.29

    npm install -S react-native-material-kit

    react-native link react-native-material-kit

Manually

  1. JDK 7+ is required
  2. Add the following snippet to your android/settings.gradle:
gradle
include ':RNMaterialKit'
project(':RNMaterialKit').projectDir = file('../node_modules/react-native-material-kit/android')
  1. Declare the dependency in your android/app/build.gradle
gradle
dependencies {
    ...
    compile project(':RNMaterialKit')
}
  1. Import com.github.xinthink.rnmk.ReactMaterialKitPackage and register it in your MainActivity (or equivalent, RN >= 0.32 MainApplication.java):
java
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.asList(
            new MainReactPackage(),
            new ReactMaterialKitPackage()
    );
}

Manual Installation Issues

If you experience any trouble manually installing react-native-material-kit on Android, you should be able to safely skip it.

Finally, you're good to go, feel free to require react-native-material-kit in your JS files.

Have fun! :metal:

Resources

  • Release Notes
  • Refer to the Annotated Source as API docs
  • Source code of Demo app
  • For contributors, please refer to How to debug local RNMK module
  • Chat about bugs/features on Gitter

Components

  • Buttons
  • Cards
  • Loading
    • Progress bar
    • Spinner
  • Sliders
    • Range Slider
  • Textfields
  • Toggles
    • Checkbox
    • Radio button
    • Icon toggle
    • Switch

Buttons

img-buttons

Apply Material Design Buttons with a few lines of code using predefined builders, which comply with the Material Design Lite default theme.

javascript
// colored button with default theme (configurable)
const ColoredRaisedButton = MKButton.coloredButton()
  .withText('BUTTON')
  .withOnPress(() => {
    console.log("Hi, it's a colored button!");
  })
  .build();

...
<ColoredRaisedButton />

And you can definitely build customized buttons from scratch.

with builder:

javascript
const CustomButton = new MKButton.Builder()
  .withBackgroundColor(MKColor.Teal)
  .withShadowRadius(2)
  .withShadowOffset({width:0, height:2})
  .withShadowOpacity(.7)
  .withShadowColor('black')
  .withOnPress(() => {
    console.log('hi, raised button!');
  })
  .withTextStyle({
    color: 'white',
    fontWeight: 'bold',
  })
  .withText('RAISED BUTTON')
  .build();

...
<CustomButton />

the jsx equivalent:

javascript
<MKButton
  backgroundColor={MKColor.Teal}
  shadowRadius={2}
  shadowOffset={{width:0, height:2}}
  shadowOpacity={.7}
  shadowColor="black"
  onPress={() => {
    console.log('hi, raised button!');
  }}
  >
  <Text pointerEvents="none"
        style={{color: 'white', fontWeight: 'bold',}}>
    RAISED BUTTON
  </Text>
</MKButton>

props reference and example code

Why builders? See the ‘Builder vs. configuration object’ discussion.

Cards

img-cards

Apply Card Style with only few styles !.

javascript
import {
  getTheme,
  ...
} from 'react-native-material-kit';

const theme = getTheme();

<View style={theme.cardStyle}>
  <Image source={{uri : base64Icon}} style={theme.cardImageStyle} />
  <Text style={theme.cardTitleStyle}>Welcome</Text>
  <Text style={theme.cardContentStyle}>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Mauris sagittis pellentesque lacus eleifend lacinia...
  </Text>
  <View style={theme.cardMenuStyle}>{menu}</View>
  <Text style={theme.cardActionStyle}>My Action</Text>
</View>

example code

Loading

MDL Loading components.

Progress bar

progress-demo

javascript
<mdl.Progress
  style={styles.progress}
  progress={0.2}
/>

props reference and example code

Spinner

spinner-demo

javascript
<mdl.Spinner />

props reference and example code

Sliders

MDL Slider components. slider-demo

javascript
<mdl.Slider style={styles.slider} />
…
const SliderWithValue = mdl.Slider.slider()
  .withStyle(styles.slider)
  .withMin(10)
  .withMax(100)
  .build();
…
<SliderWithValue
  ref="sliderWithValue"
  onChange={(curValue) => this.setState({curValue})}
/>

props reference and example code

Range Slider

range-slider-demo

javascript
<mdl.RangeSlider style={styles.slider} />
…
const SliderWithRange = mdl.RangeSlider.slider()
  .withStyle(styles.slider)
  .withMin(10)
  .withMax(100)
  .withMinValue(30)
  .withMaxValue(50)
  .build();
…
<SliderWithRange
  ref="sliderWithRange"
  onChange={(curValue) => this.setState({
    min: curValue.min,
    max: curValue.max,
    })
  }
  onConfirm={(curValue) => {
    console.log("Slider drag ended");
    console.log(curValue);
  }}
/>

props reference and example code

Text Fields

Built-in textfields, which comply with Material Design Lite.

img-tf

javascript
// textfield with default theme (configurable)
const Textfield = MKTextField.textfield()
  .withPlaceholder('Text...')
  .withStyle(styles.textfield)
  .build();

...
<Textfield />

Customizing textfields through builder:

javascript
const CustomTextfield = mdl.Textfield.textfield()
  .withPlaceholder("Text...")
  .withStyle(styles.textfield)
  .withTintColor(MKColor.Lime)
  .withTextInputStyle({color: MKColor.Orange})
  .build();
...
<CustomTextfield />

the jsx equivalent:

javascript
<Textfield
  tintColor={MKColor.Lime}
  textInputStyle={{color: MKColor.Orange}}
  placeholder=“Text…”
  style={styles.textfield}
/>

props reference and example code

Toggles

Icon toggle & [Switch][mdl-switch] ![img-toggles]

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptmaterial-designreact-native

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架