Actions Core Stable

Button

The foundational push-button: six variants, three sizes, a loading state, and a polymorphic href/anchor mode

Preview

Installation

pnpm add fancy-ui-svelte
import { Button } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { Button } from 'fancy-ui-svelte';
</script>

<Button />

Examples

Basic Usage

Variants

All six visual treatments.

Sizes

Small, medium, and large.

Loading State

Spinner in place of the icon, activation blocked, no dimming.

With Icons

iconStart and iconEnd snippets.

href renders an anchor instead of a button.

Disabled State

Disabled on the button vs. the anchor — two different mechanisms.

Props

PropTypeDefaultDescription
variant "primary" | "secondary" | "outline" | "ghost" | "accent" | "destructive""primary"Visual treatment
size "sm" | "md" | "lg""md"Padding / font-size / radius scale
type "button" | "submit" | "reset""button"Native type; ignored once href renders an anchor instead
disabled booleanfalseGreys the button out and blocks activation
loading booleanfalseSpinner in place of iconStart, aria-busy, inert to activation on both the button and anchor branch — does not dim the button
href string-Renders an <a> instead of a <button> when set
target string-Anchor target. "_blank" forces a safe rel
rel string-Anchor rel, widened rather than replaced when target="_blank"
fullWidth booleanfalseStretches the button to its container's width
label string-Accessible name for a button whose content is icon-only
onclick (event: MouseEvent) => void-Fires on activation; never called while disabled or loading
class string-Additional CSS classes
ref HTMLButtonElement | HTMLAnchorElement | nullnullBindable element reference
sound booleanfalsePlays the press cue on activation, once the user has enabled sound

Slots

SlotDescription
childrenThe button's label / content
iconStartRendered before the label; replaced by the spinner while loading
iconEndRendered after the label