Skip to content
↑↓ to navigate↵ to openesc to close

Menu

Button

Magnetic Button

MagneticButton.vue

Install

Run it in a project set up with shadcn-vue. The source is copied to components/beui and its dependencies are added to your package.json. Read the shadcn-vue guide

bunx --bun shadcn-vue@latest add @beui-vue/button-magnetic

Import the shared styles once in your application.

TSUsage
import MagneticButton from '@/components/beui/actions/MagneticButton.vue'
import '@/components/beui/styles.css'

API Reference

class?
string
Default—
size?
"sm" | "md" | "lg" | "icon"
Default—
variant?
"primary" | "secondary" | "ghost" | "outline"
Default—
pressScale?
number
Default—
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

Default—
strength?
number

Magnetic pull strength. Default 0.25.

Default0.25
magneticClassName?
string

Class applied to the magnetic wrapper.

Default—
Also on React Native. Spring press, ripple, icons and a stateful variant.(opens in a new tab)

Used in these Pro blocks

Updated