Button
The Button component triggers an event or an action. Examples can be submitting forms and deleting, update, add a data point.
import { Button } from 'cherag-ui'
Usage
Example 1
<Button
w={"20%"}
h={"10%"}
bg={COLORS.primary}
color={COLORS.white}
borderRadius={10}
onPress={() => {
console.log("Button component test");
}}
>
Button component
</Button>
Example 2
<Button
w={"20%"}
h={"10%"}
borderRadius={5}
fontSize={18}
bg={COLORS.blue}
color={COLORS.white}
onPress={() => console.log("Button component test")}
style={{
justifyContent: "center",
borderColor: COLORS.lightPrimary,
marginBottom: 15,
}}
>
Add product
</Button>
Example 3
<Button
w={"10%"}
h={"10%"}
borderRadius={5}
fontSize={12}
bg={COLORS.errorIcon}
color={COLORS.white}
onPress={() => console.log("Button component test")}
>
Submit
</Button>
Props
Button
children
React.ReactNode
Name of the button.
onPress
(event: GestureResponderEvent) => void
Providing button onPress Action.
style
StyleProp<ViewStyle>
Style of Button.
bg
string
Background color of button.
color
string
Button text color.
fontSize
number
Font size color of button.
fontWeight
string
Font weight of button text.
borderRadius
number
Border radius of button outerline.
borderWidth
number
thickness of border.
fontWeight
TextStyle['fontWeight']
fontWeight of Button text.