UIR

GlowButton

A bottom action button for payment-style flows. The screen blurs, a soft colour glow drifts where the button was while your work runs, then it surges up over the screen and reveals a success state.

Preview

Preview coming soon

Try it live: run the CLI command below in an Expo app, or open the Code tab.

Installation

npx @codewithrabby/ui@latest add glow-button

Usage

import { GlowButton } from "@/components/uir/glow-button";

<View style={{ flex: 1, backgroundColor: "#151515" }}>
  {/* your screen content */}
  <GlowButton
    label="Continue"
    loadingLabel="Topping up wallet"
    doneLabel="Wallet topped up"
    bottomInset={insets.bottom}
    onPress={() => api.topUp(amount)}   // glow runs until this resolves
    onError={(e) => toast.error("Top-up failed")}
    onDismiss={() => router.back()}
    // colors={["#06b6d4", "#3b82f6", "#a855f7"]}
  />
</View>

Props

PropTypeDefault
label

Button text.

string—
onPress

The work to do. The glow runs until the promise settles.

() => void | Promise<void>—
loadingLabel

Shown in the middle of the screen while loading.

string"Processing"
doneLabel

Shown on the success screen.

string"Done"
doneContent

Replace the success screen's content.

ReactNode—
onDismiss

Tapping the success screen calls this and resets the button.

() => void—
onError

Called if onPress throws. The glow fades and the button comes back.

(error) => void—
minDuration

Keep the glow up at least this long (ms).

number1500
colors

Glow colours, left to right. Any number.

string[]purple, pink, orange, cream
backgroundColor

Success screen background. Match your screen.

string"#151515"
buttonColor

Button background.

string"#ffffff"
buttonTextColor

Button text colour.

string"#111111"
bottomInset

Extra space under the button, e.g. the safe-area bottom.

number0