PILOT // NEXTUI
Button
Dashboard button with primary, secondary, and ghost variants in three sizes. Handles disabled links by rendering an aria-disabled span instead of a Link.
$
Or install the base component for free:
Live Preview
Usage
TSX
<Button variant="primary" size="md">Deploy</Button>Variants
<Button variant="primary">Deploy</Button>
<Button variant="secondary">Settings</Button>
<Button variant="ghost">Cancel</Button>
<Button variant="primary" size="sm">Save</Button>
<Button variant="primary" size="lg">Create project</Button>
<Button variant="primary" href="/deploy" disabled>Unavailable</Button>
Source
TSX
import type * as React from 'react'
import Link from 'next/link'
import { cn } from '@/lib/utils'
type ButtonVariant = 'primary' | 'secondary' | 'ghost'
type ButtonSize = 'sm' | 'md' | 'lg'
interface ButtonProps {
variant?: ButtonVariant
size?: ButtonSize
href?: string
disabled?: boolean
type?: 'button' | 'submit' | 'reset'
onClick?: () => void
className?: string
children: React.ReactNode
}
const variantClass: Record<ButtonVariant, string> = {
primary: 'pilot-btn-primary',
secondary: 'pilot-btn-secondary',
ghost: 'pilot-btn-ghost',
}
const sizeClass: Record<ButtonSize, string> = {
sm: 'pilot-btn-sm',
md: '',
lg: 'pilot-btn-lg',
}
export function Button({
variant = 'primary',
size = 'md',
href,
disabled,
type = 'button',
onClick,
className,
children,
}: ButtonProps): React.JSX.Element {
const classes = cn('pilot-btn', variantClass[variant], sizeClass[size], className)
if (href) {
if (disabled) {
return (
<span className={classes} aria-disabled="true">
{children}
</span>
)
}
return (
<Link href={href} className={classes} onClick={onClick}>
{children}
</Link>
)
}
return (
<button
type={type}
onClick={onClick}
disabled={disabled}
className={classes}
>
{children}
</button>
)
}
Works withNext.js 15React 19Tailwind v4TypeScript 5
More from PILOT // NEXT
CopyField
Read-only code field with a one-click copy-to-clipboard button. Shows a checkmark and "Copied!" confirmation for 2 seconds after copying. Client component.
View sourceNo preview
DateRangePicker
Dropdown date range selector with preset intervals (7, 14, 30, 90 days). Displays the computed date range in the trigger button and closes on route change. Client component.
View sourceNo preview