Button
Component
Is a button that can be used in a React application. It displays text, icons, and provides various interactive features like debouncing and loading indicators. Users can interact with the button by clicking on it.
Source
View source code
Package
@codeleap/web
Props
debounce
(optional): The time in milliseconds to debounce the click event. By setting a debounce value, the button will wait for the specified time before triggering the onPress
event. (Type: number)
debugName
: A string to help identify the button during debugging or development. (Type: string)
icon
(optional): An IconPlaceholder component to be displayed as the left icon of the button. (Type: IconPlaceholder)
loading
(optional): Indicates whether the button is in a loading state. (Type: boolean)
onPress
(optional): A function that will be called when the button is pressed. (Type: AnyFunction)
rightIcon
(optional): An IconPlaceholder component to be displayed as the right icon of the button. (Type: IconPlaceholder)
selected
(optional): Indicates whether the button is selected. (Type: boolean)
text
(optional): The text to be displayed on the button. (Type: string)
Example Usage
import * as React from 'react';import { Button } from '@codeleap/web';const MyComponent = () => {const handleButtonPress = () => {console.log('Button pressed!');};return (<ButtondebugName="myButton"text="Click me"onPress={handleButtonPress}/>);};export default MyComponent;