Button
Overview
LMButton
is a customizable button component that supports text and icon display, with options to define actions, style, placement, and active/inactive states. It also allows for different content when the button is active and includes flexibility in design and interaction.
GitHub File:
Props
Interaction Callbacks
onTap
: Callback to handle tap events trigerred by on clicking on the button.
Customisation Props
Property | Type | Description | Required |
---|---|---|---|
text | LMTextProps | Represents the text displayed on the button | |
icon | LMIconProps | Represents the icon displayed on the button | |
onTap | Function | Functionality executed when the button is clicked | ✔️ |
placement | 'start' or 'end' | Placement of the icon on the button | |
isActive | boolean | Represents the active/inactive state of the button | |
activeIcon | LMIconProps | Icon displayed when the button is in the active state | |
activeText | LMTextProps | Text displayed when the button is in the active state | |
buttonStyle | ViewStyle | Style of the button | |
isClickable | boolean | Indicates if the button is clickable or disabled |
Usage Example
<LMButton
placement="end"
text={{
children: "example text",
}}
buttonStyle={{
borderRadius: 10,
elevation: 6,
}}
icon={{
assetPath: require("../../assets/images/AIChatBot.png"),
iconStyle: {
height: Layout.normalize(30),
width: Layout.normalize(30),
},
}}
/>