Skip to content

Latest commit

 

History

History
171 lines (161 loc) · 6.08 KB

Button.md

File metadata and controls

171 lines (161 loc) · 6.08 KB

Button

Button is a pure NativeBase component.
Buttons are the integral part of an application. They are used for various purposes like, submit or reset a form, navigate, performing interactive actions such as showing or hiding something in an app on click of the button, etc.


IOS Android

Contents:

Syntax

import React, { Component } from 'react';
import { Container, Content, Button } from 'native-base';
​
export default class ButtonExample extends Component {
    render() {
        return (
            <Container>
                <Content>
                    // NativeBase default style
                    <Button> Click Me! </Button>
                </Content>
            </Container>
        );
    }
}

  • NativeBase provides Button component which is readily not available in React Native.
  • Supports React Native app on both iOS and Android devices.
  • Button component takes input such as: Text, Icon, Text with Icon.
  • NativeBase gives you privilege to customize the props of this component.
    Example: To have custom style for button, include them in style prop of button.
  • Intakes user-defined styles.
  • NativeBase has provided its users with enormous list of props that can be used with Button.
  • Replacing Component: React Native <TouchableOpacity>

**Configuration**
Property Default Option Description
style - - Defines button style
textStyle - - Defines button text style
block - - Block level button
rounded - - Renders button with slightly round shaped edges.
bordered - - Applies outline button style.
transparent - - Gives you effect of Icon-buttons.
To have button with transparent background, include this prop.
small - - For small size button
large - - For large size button
iconLeft - - Used for Icon alignment.
Aligns icon to the left in button.
By default, icons are aligned to the left in button.
iconRight - - Used for Icon alignment.
Aligns icon to the right in button.
disabled true true
false
Disables click option for button
capitalize true true
false
Displays Button text in uppercase. (only Android)