YaVendio Registry
Components

YA Button

Interactive button component with primary, secondary, tertiary, ghost, and destructive variants

The YaButton is the primary interactive element in the YaVendio Design System. It supports multiple variants, sizes, icons, loading states, and the selected state for toggle-like interactions.

Quick Start

pnpm dlx shadcn@latest add @yavendio/ya-button
npx shadcn@latest add @yavendio/ya-button
yarn dlx shadcn@latest add @yavendio/ya-button
import { YaButton } from '@/components/ui/ya-button'

export default function Example() {
  return <YaButton>Click me</YaButton>
}

Variants

Five visual variants for different contexts and actions.

VariantUsageDescription
primaryMain CTAPurple background with inset shadow, most prominent
secondarySecondary actionsGray background with subtle shadow
tertiaryTertiary actionsTransparent with border, good visibility
ghostToolbar/subtle actionsNo background, appears on hover
destructiveDangerous actionsRed background for delete/remove operations
<YaButton variant="primary">Primary</YaButton>
<YaButton variant="secondary">Secondary</YaButton>
<YaButton variant="tertiary">Tertiary</YaButton>
<YaButton variant="ghost">Ghost</YaButton>
<YaButton variant="destructive">Destructive</YaButton>

Sizes

Three sizes for buttons with text, plus three icon-only sizes.

SizeHeightFont SizeIcon SizeUsage
lg40px14px16pxProminent CTAs
default32px14px16pxStandard buttons
sm28px12px14pxCompact UIs, tables
icon-lg40x40px-16pxLarge icon buttons
icon32x32px-16pxStandard icon buttons
icon-sm24x24px-14pxCompact icon buttons
<YaButton size="sm">Small</YaButton>
<YaButton size="default">Default</YaButton>
<YaButton size="lg">Large</YaButton>

Icons

Add icons to the left or right of the button text. Icons are automatically sized based on button size.

import { Plus, ArrowRight, Download } from 'lucide-react'

<YaButton leftIcon={<Plus />}>Add Item</YaButton>
<YaButton rightIcon={<ArrowRight />}>Continue</YaButton>
<YaButton leftIcon={<Download />} rightIcon={<ArrowRight />}>Download</YaButton>

Works best with Lucide React. The component automatically clones and resizes icon elements.

Icon Only

For toolbar actions or compact UIs, use icon-only button sizes.

import { Search, Settings, Plus } from 'lucide-react'

<YaButton size="icon-sm" aria-label="Search"><Search /></YaButton>
<YaButton size="icon" aria-label="Settings"><Settings /></YaButton>
<YaButton size="icon-lg" aria-label="Add"><Plus /></YaButton>

Always provide aria-label for icon-only buttons to ensure screen reader accessibility.

Loading State

Show a loading spinner when an action is in progress. The button is automatically disabled during loading.

const [loading, setLoading] = useState(false)

<YaButton loading>Loading</YaButton>
<YaButton loading={loading} onClick={() => setLoading(true)}>
  {loading ? 'Saving...' : 'Save'}
</YaButton>

Disabled State

Disable buttons that cannot be interacted with. Uses native disabled attribute with 50% opacity.

<YaButton disabled>Primary</YaButton>
<YaButton variant="secondary" disabled>Secondary</YaButton>
<YaButton variant="tertiary" disabled>Tertiary</YaButton>

Ghost Variant

Ghost buttons are ideal for toolbars or groups where interaction is already implied.

<YaButton variant="ghost">Ghost Button</YaButton>
<YaButton variant="ghost" leftIcon={<Settings />}>Settings</YaButton>
<YaButton variant="ghost" size="icon" aria-label="Like"><Heart /></YaButton>

Destructive Actions

Use destructive buttons for actions that permanently cause data loss.

import { Trash2 } from 'lucide-react'

<YaButton variant="destructive">Delete</YaButton>
<YaButton variant="destructive" leftIcon={<Trash2 />}>Delete Account</YaButton>

Because destructive actions cannot be undone, use button hierarchy to reduce errors: pair a secondary destructive with a primary destructive in confirmation dialogs.

All Variants & Sizes

Examples

Button Group

<div className="flex gap-2">
  <YaButton variant="primary">Save</YaButton>
  <YaButton variant="secondary">Cancel</YaButton>
</div>

Form Actions

<div className="flex justify-end gap-2">
  <YaButton variant="tertiary">Cancel</YaButton>
  <YaButton variant="primary" leftIcon={<Check />}>Confirm</YaButton>
</div>

Toolbar with Icon Buttons

<div className="flex gap-1 rounded-lg border p-1">
  <YaButton variant="ghost" size="icon" aria-label="Star"><Star /></YaButton>
  <YaButton variant="ghost" size="icon" aria-label="Heart"><Heart /></YaButton>
  <YaButton variant="ghost" size="icon" aria-label="Send"><Send /></YaButton>
</div>

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'tertiary' | 'ghost' | 'destructive''primary'Visual style
size'lg' | 'default' | 'sm' | 'icon-lg' | 'icon' | 'icon-sm''default'Button size
selectedbooleanfalseToggle selected state (yellow ring)
loadingbooleanfalseShow loading spinner
disabledbooleanfalseDisable button
leftIconReactNode-Icon on the left
rightIconReactNode-Icon on the right
classNamestring-Additional classes

Extends all standard <button> HTML attributes.

Accessibility

Best Practices

DoDon't
Use primary for the main CTAMultiple primary buttons in one area
Use destructive for delete/remove actionsRed styling without destructive variant
Provide aria-label for icon-only buttonsIcon buttons without accessible names
Show loading state during async actionsAllow multiple clicks during loading
Use button hierarchy in dialogsEqual prominence for all options
Keep button text concise: "Save", "Delete"Very long button labels

TypeScript

import { type VariantProps } from 'class-variance-authority'
import { yaButtonVariants } from '@/components/ui/ya-button'

type ButtonVariant = VariantProps<typeof yaButtonVariants>['variant']
type ButtonSize = VariantProps<typeof yaButtonVariants>['size']

On this page