Skip to content

shadcn.io is an independent project built on shadcn/ui

Buttons

Pro

Liquid Button for Vue UI SDK

Fills from the bottom on hover like water, the label recoloring at the waterline. For Vue with UI SDK, when a submit should feel like it fills up.

On this page7 sections

When the pointer arrives or the button takes keyboard focus, a fill rises from the bottom edge like water in a glass, and drains when it leaves. The label above the waterline keeps its color and the part below it turns to the fill's text color, so it reads all the way through.

Use it on a form's submit or a primary call to action that sits on a quiet page; for a fill that slides in from the side of a pill, use the Pill Button. It starts as an outline button so the empty state is a frame, and it wraps the Button, so every variant and size works. The fill is a second copy of the label on a colored layer, uncovered by a rising clip-path in a CSS transition, with no animation library and no JavaScript. With reduced motion the fill fades in and out instead of rising.

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

<script setup lang="ts">
import { LiquidButton } from "@/components/ui/liquid-button";
</script>
<template>
  <LiquidButton>Subscribe</LiquidButton>
</template>

Demos

Duration

duration is how long the fill takes to rise, and to drain, in milliseconds; the default is 500. A short one suits a small button that's hovered often, a long one a large call to action that can take its time.

Preview width

Color

fillColor is the fill and fillForeground the label's color where the fill covers it, each any CSS color; by default they're the primary color and its foreground. Set them together so the covered label stays readable. Here a send button fills with the foreground color and a delete button with the destructive one. Icons in the label change color with the text.

Preview width

Accessibility

The button is announced and activated as any Button. The fill's copy of the label is hidden from assistive tech, so the label is read once. Keyboard focus fills the button as hover does, so people who tab see the same cue.

Enter
Activate the button.
Space
Activate the button.

FAQ

How does the fill work?

The button holds a colored layer with its own copy of the label, clipped to nothing. On hover a clip-path uncovers it from the bottom up, so the fill and the label's new color move as one edge.

How do I change the fill color?

Pass fillColor, and fillForeground for the label on it, such as var(--foreground) and var(--background). The Color demo shows two.

How do I make the fill rise slower?

Set duration in milliseconds; 500 is the default. The Duration demo shows 250 and 1200.

Why does it start as an outline button?

So the empty state reads as a frame waiting to fill. Pass any other variant to change it; the fill covers it the same way.

Why is my label rendered twice?

The second copy is the one inside the fill, and it's hidden from assistive tech. Keep the label to text and icons: anything with its own state would run twice.

What happens with reduced motion?

The fill doesn't rise or drain: it fades in over the whole button on hover and focus, and fades out when they end, in the same duration.

API Reference

LiquidButton

data-slot="liquid-button-fill"

PropType
children?VNode

The label, drawn again on the fill in fillForeground.

clickEffect?boolean

Apply a click effect to the button.

Default
true
debug?boolean

Logs every state change with its reason to the console, in development builds.

disabled?boolean

Stops presses. The button is natively disabled, so it leaves the tab order and its form doesn't submit through it, unless focusableWhenDisabled is set.

Default
false
duration?number

How long the fill takes to rise, and to drain, in milliseconds.

Default
500
fillColor?string

The fill's color, any CSS color.

Default
"var(--primary)"
fillForeground?string

The label's color where the fill covers it, any CSS color: pick one that reads on fillColor.

Default
"var(--primary-foreground)"
focusableWhenDisabled?boolean

Keeps a disabled button in the tab order with aria-disabled instead of the native attribute, so it can hold focus while it becomes disabled and host a tooltip that says why. Presses still do nothing.

Default
false
isLoading?boolean

Show a loading indicator.

Default
false
pendingAnnouncement?string

What screen readers hear once the button has been pending for a second, so a slow action doesn't pass in silence. Set it in the page's language. An empty string says nothing.

Default
"Loading"
type?"button" | "reset" | "submit"

What a native button does in a form: "submit" submits it and "reset" resets it. Ignored when the button renders as something else.

Type
"button" | "reset" | "submit"
Default
"button"
#render?{ props, state, children }

A slot that renders your own element: bind its props with v-bind="props". It also gets the part's state, and children, its content.

class?string

Forwarded to the part.

EventType
@click( event: MouseEvent, details?: ButtonActionDetails ) → unknown

Runs when the button is pressed. Return a Promise to keep it pending (data-pending) until it settles. details.source says how it was pressed; a wrapper passing the click on may leave it out.

Type
( event: MouseEvent, details?: ButtonActionDetails ) → unknown
Parameters

event – React.MouseEvent<HTMLButtonElement>

details? – ButtonActionDetails

Returns
unknown
CSS variableType
--liquid-button-durationstring

The rise, and the drain (500ms).

--liquid-button-fillstring

The fill's color.

--liquid-button-fill-foregroundstring

The label's color on the fill.