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

NameTypeDefaultDetails
disabledbooleanfalseDisables the button.
classNamestring' 'You can customise by passing tailwind classes.
isOutlinebooleanfalseYou can pass this to create outline button.
isLoadingbooleanfalseYou can pass this to show loading indication.
loadingTextstring' 'You can pass this to show customised loading text.
leftIconReact.ReactNodeOptionalIcon to display on the left side of button.
rightIconReact.ReactNodeOptionalIcon to display on the right side of button.
childrenReact.ReactNodeRequiredYou can pass button content as children.