Button

free

Button gives product actions a consistent hierarchy across forms, dialogs, and toolbars.

import Button from '@/components/ui/button';

export default function UsageDemo() {
  return (

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Button

Examples

Variants

import Button from '@/components/ui/button';

export default function VariantDemo() {
  return (

Sizes

import Button from '@/components/ui/button';

export default function SizeDemo() {
  return (

Shapes

import { PiPlus } from 'react-icons/pi'
import Button from '@/components/ui/button';

export default function ShapeDemo() {

States

import Button from '@/components/ui/button';

export default function StatesDemo() {
  return (

Destructive

import Button from '@/components/ui/button';

export default function DestructiveDemo() {
  return (

Icons

import { PiArrowRight, PiEnvelope, PiPlus } from 'react-icons/pi'
import Button from '@/components/ui/button';

export default function IconDemo() {

Block

import Button from '@/components/ui/button';

export default function BlockDemo() {
  return (

API

Button accepts the props below plus native props for the rendered element.

PropDescriptionTypeDefault
asElementRoot element or component rendered by the button.ElementType'button'
activeMarks the button as active and applies the active visual state.booleanfalse
blockExpands the button to the full width of its container.booleanfalse
childrenButton label or content.ReactNode-
classNameStatic class string or state-aware class callback.ButtonClassName-
clickFeedbackEnables the press-down transform feedback on activation.booleantrue
destructiveSwitches the button into the destructive intent palette.booleanfalse
disabledPrevents interaction and applies the disabled visual state.booleanfalse
iconIcon content rendered with, or instead of, the label.string | ReactNode-
iconAlignmentIcon placement when both icon and label are present.ButtonIconAlignment'start'
loadingShows a spinner and prevents repeat activation.booleanfalse
onClickClick handler invoked only when the button is not disabled or loading.ButtonClickHandler-
refRef forwarded to the underlying button element.Ref<HTMLButtonElement>-
shapeBorder radius treatment.ButtonShape'round'
sizeControl size. Falls back to InputGroup size, then ConfigProvider control size.ControlSize'md' from ConfigProvider
variantVisual style.ButtonVariant'default'
...nativePropsNative props for the rendered element, excluding Button-owned props.NativeButtonProps<E>-

Types

type ButtonVariant = 'solid' | 'subtle' | 'default' | 'ghost' | 'link';
type ControlSize = 'sm' | 'md' | 'lg';
type ButtonShape = 'round' | 'circle' | 'none';
type ButtonIconAlignment = 'start' | 'end';
type ButtonClickHandler = (event: MouseEvent<HTMLButtonElement>) => void;
 
type ButtonClassName =
  | string
  | ((state: {
      active: boolean;
      destructive: boolean;
      unclickable: boolean;
    }) => string);
 
type NativeButtonProps<E extends ElementType> = Omit<
  ComponentPropsWithoutRef<E>,
  | 'asElement'
  | 'active'
  | 'block'
  | 'className'
  | 'clickFeedback'
  | 'destructive'
  | 'disabled'
  | 'icon'
  | 'iconAlignment'
  | 'loading'
  | 'onClick'
  | 'ref'
  | 'shape'
  | 'size'
  | 'variant'
>;