Actions Core Stable

IconButton

Square or circular icon-only button built on Button, with a required accessible label

Preview

Installation

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

Usage

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

<IconButton />

Examples

Basic Usage

Variants

Sizes

Shapes

Props

PropTypeDefaultDescription
label *string-Accessible name. Required — there is no visible text to fall back on
variant "primary" | "secondary" | "outline" | "ghost" | "accent" | "destructive""outline"Visual treatment, forwarded to the underlying Button
size "sm" | "md" | "lg""md"Square footprint (30 / 36 / 42px) and resting radius
shape "square" | "circle""square"Square keeps the size's own radius; circle rounds it fully
type "button" | "submit" | "reset""button"Native type; ignored once href renders an anchor instead
disabled booleanfalseGreys the control out and blocks activation
loading booleanfalseSpinner in place of the icon, aria-busy, blocks activation
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"
onclick (event: MouseEvent) => void-Fires on activation; never called while disabled or loading
class string-Additional CSS classes
ref HTMLButtonElement | HTMLAnchorElement | nullnullBindable element reference

Slots

SlotDescription
childrenThe icon, rendered centred