Buttons Fancy Stable

Pressable

A wrapper that gives any interactive child a consistent, cross-browser press animation — scale down on pointerdown/keydown, back to rest on release, with a static opacity fallback under reduced motion

Preview

Installation

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

Usage

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

<Pressable />

Examples

Basic Usage

With Haptics

Touch-only vibration patterns alongside the press scale.

Props

PropTypeDefaultDescription
scale number0.97Target scale() factor while pressed
haptic false | "light" | "medium" | "heavy" | "success" | "error"falseTouch-only vibration pattern fired on pointerdown; false never vibrates
disabled booleanfalseSuppresses every listener; data-pressed never appears
class string-Additional CSS classes, merged onto the wrapper
ref HTMLDivElement | nullnullBindable reference to the wrapper element

Slots

SlotDescription
childrenExactly one interactive child (documented, not enforced at runtime)