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:
- Button Theme
- Block Button
- Rounded Button
- Icon Button
- Outline Button
- Transparent Button
- Button Size
- Disabled Button
- Capitalize Button Size
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
Buttoncomponent 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 instyleprop of button. - Intakes user-defined styles.
- NativeBase has provided its users with enormous list of
propsthat 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) |

