Modus UI

Current Button

Web (React)

A WebGL pill filled with a slow ink current that quickens on hover and flares on press.

A raw-WebGL pill filled with a domain-warped current of ink, drawn from the theme's primary, foreground and background colours, over a faint paper-grain field. Hover quickens the current and pressing the button flares it toward the paper colour. The label is set in uppercase mono. Colours are re-read when the theme or palette changes, so it sits on paper in light mode and on the dark ground in dark mode. It fills its positioned parent, pauses when off screen or when the tab is hidden, and holds a still frame when the user prefers reduced motion.

Modus / Current Button

Installation

CLI

npx @modus-ui/cli add current-button

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/current-button.tsx.
  3. Paste the code.

Usage

tsx
import { CurrentButton } from "@/components/ui/current-button";

export default function Example() {
  return (
    <div className="relative h-[400px] w-full overflow-hidden">
      <CurrentButton />
    </div>
  );
}

Props

PropTypeDefaultDescription
labelstring"Run the draft"Button text.
huenumber0Hue rotation in degrees (-180 to 180).
saturationnumber1Saturation multiplier (0 to 2).
brightnessnumber1Brightness multiplier (0.35 to 1.65).
onMouseDownButtonHTMLAttributes["onMouseDown"]-Called after the button's own mouse down effect.
onKeyDownButtonHTMLAttributes["onKeyDown"]-Called after the button's own key down effect.
onMouseEnterButtonHTMLAttributes["onMouseEnter"]-Called after the button's own mouse enter effect.
onMouseLeaveButtonHTMLAttributes["onMouseLeave"]-Called after the button's own mouse leave effect.
onFocusButtonHTMLAttributes["onFocus"]-Called after the button's own focus effect.
onBlurButtonHTMLAttributes["onBlur"]-Called after the button's own blur effect.

Any other <button> attribute is passed through to the inner button.

Comments

  • No comments yet.