Modus UI

Beat Mark

Web (React)

A like button whose icon bursts and whose counter rolls on press.

The default is a squared mono pill with a star mark on the muted surface.

Modus / Beat Mark

Installation

CLI

npx @modus-ui/cli add beat-mark

Manual

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

Usage

tsx
import { BeatMark } from "@/components/ui/beat-mark";

export default function Example() {
  return <BeatMark />;
}

Props

PropTypeDefaultDescription
likedany-Controlled liked state.
defaultLikedbooleanfalseInitial liked state when uncontrolled.
countnumber128Count before your like.
onChangeany-Called with the new liked state.
showCountbooleantrueShows the rolling counter.
iconstring"star"Mark shape: "star" or "heart".
idleOutlinebooleantrueDraws the idle mark as an outline.
sizenumber40Mark box size in pixels.
cornernumber10Pill corner radius in pixels.
likedColorstring"hsl(var(--primary))"Mark and burst colour when liked.
idleColorstring"hsl(var(--muted-foreground))"Mark colour when idle.
pillColorstring"hsl(var(--muted))"Pill background colour.
textColorstring"hsl(var(--foreground))"Counter colour.
durationnumber560Pop and burst duration in milliseconds.
dotSizenumber0.3Burst dot size as a fraction of the mark.
overshootnumber1.7How far the mark overshoots as it pops.
beatnumber3Burst dots per quarter turn.
rollDurationnumber350Counter roll duration in milliseconds.
disabledbooleanfalseDisables the button.
labelstring"Like"Accessible label.

Comments

  • No comments yet.