Get Started
Components
Button
A Button component is a fundamental UI element that allows users to trigger actions or events, such as submitting a form, opening a dialog, or navigating to another page. Buttons are interactive and typically styled to stand out, making it easy for users to identify and interact with them. They can come in various types, such as primary, secondary, or disabled, depending on their purpose or state.
Demo
Usage
import { NButton } from '@nayan-ui/react';const Button = () => {return (<div className="flex flex-wrap gap-2"><NButton onClick={() => console.log('clicked')}>Primary</NButton><NButton isOutline={true}>Outline</NButton><NButton isLoading={true}>Loading</NButton><NButton disabled>Disabled</NButton></div>);};export default Button;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| disabled | boolean | false | Disables the button. |
| className | string | ' ' | You can customise by passing tailwind classes. |
| isOutline | boolean | false | You can pass this to create outline button. |
| isLoading | boolean | false | You can pass this to show loading indication. |
| loadingText | string | ' ' | You can pass this to show customised loading text. |
| leftIcon | React.ReactNode | Optional | Icon to display on the left side of button. |
| rightIcon | React.ReactNode | Optional | Icon to display on the right side of button. |
| children | React.ReactNode | Required | You can pass button content as children. |