LikeButton

Heart squashes and bounces, fills, and throws out a ring of dots. The count rolls by one. Buttons.

Open playground

About

LikeButton is a React component in the Buttons category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { LikeButton } from "@ashutoshswamy/smoui" and set count, defaultLiked, onChange.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { LikeButton } from "@ashutoshswamy/smoui";

<LikeButton count={1284} onChange={(liked) => save(liked)} />

Props 3

count

Count without your like. Shown +1 while liked.

number
defaultLiked

Start liked.

booleandefault false
onChange

Called on toggle.

(liked: boolean) => void