Skip to main content
PROYECTOVIVIANA

Button

Buttons allow users to perform actions with a single click or tap. They are the primary way users interact with your application.

Import

import { Button, Link } from '@proyecto-viviana/solid-spectrum';

Variants

Buttons come in four semantic variants to convey different levels of importance.

<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="accent">Accent</Button>
<Button variant="negative">Negative</Button>

Styles

Each variant can be rendered in fill (default) or outline style.

<Button variant="primary" fillStyle="fill">Fill</Button>
<Button variant="primary" fillStyle="outline">Outline</Button>

Disabled State

Disabled buttons cannot be interacted with and appear visually muted.

<Button isDisabled>Disabled</Button>

Press Events

Use onPress for click handling. It normalizes mouse, touch, and keyboard interactions.

<Button onPress={() => setCount(c => c + 1)}>
  Clicked {count()} times
</Button>

Navigation

Use Link for navigation semantics and Button for actions.

<Link href="https://github.com/proyecto-viviana" target="_blank" rel="noopener noreferrer">
  View on GitHub
</Link>

Props

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'accent' | 'negative' | 'premium' | 'genai''primary'Visual style variant
fillStyle'fill' | 'outline''fill'Background fill style
isDisabledbooleanfalseWhether the button is disabled
onPress(e: PressEvent) => voidHandler called when the button is pressed
onPressStart(e: PressEvent) => voidHandler called when press starts
onPressEnd(e: PressEvent) => voidHandler called when press ends
type'button' | 'submit' | 'reset''button'Button type for forms
isPendingbooleanfalseWhether the button is in a pending/loading state
childrenJSX.ElementButton content
classstringAdditional CSS classes

Accessibility

  • Uses native <button> element for proper semantics
  • Supports keyboard activation via Enter and Space keys
  • Focus ring visible only on keyboard navigation (not mouse clicks)
  • Disabled state communicated via native disabled semantics
  • Press events normalize mouse, touch, and keyboard interactions