LikeButton
LikeButton is an animated like button component for React Native and React, from the dissolve library. Heart that pops with sparks on like and snaps into grains on unlike.
Like: the heart pops and ten sparks burst around it. Unlike: the filled heart snaps away into grains from its center and the outline is back.
Install
React Native
Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:
npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-hapticsnpx dissolve-ui add like-button --nativenpx shadcn@latest add https://dissolve.rselmi.com/r/native/like-button.jsonReact
Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.
npx dissolve-ui add like-button --webnpx shadcn@latest add https://dissolve.rselmi.com/r/like-button.jsonUsage
import { useState } from 'react';
import { LikeButton } from '@/components/dissolve/like-button';
export function PostActions() {
const [liked, setLiked] = useState(false);
const [likes, setLikes] = useState(128);
return (
<LikeButton
liked={liked}
count={likes}
onChange={(v) => {
setLiked(v);
setLikes((n) => n + (v ? 1 : -1));
}}
/>
);
}import { useState } from 'react';
import { LikeButton } from '@/components/dissolve/like-button';
export function PostActions() {
const [liked, setLiked] = useState(false);
const [likes, setLikes] = useState(128);
return (
<LikeButton
liked={liked}
count={likes}
onChange={(v) => {
setLiked(v);
setLikes((n) => n + (v ? 1 : -1));
}}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
liked | boolean | required | Controlled state. |
onChange | (liked: boolean) => void | required | Called with true right away on like, with false once the heart has snapped away. |
size | number | 26 | Heart size in points. |
color | string | '#FF2D55' | Filled heart and counter when liked. |
idleColor | string | muted token | Outline and counter when not liked. |
count | number | Optional counter shown next to the heart. | |
haptics | boolean | true | Light impact on like, the snap ticks on unlike. |
className | string | 'flex-row items-center gap-1.5' | Row: gap, padding, margins. |
countClassName | string | 'text-[15px] font-semibold' | Counter text: size, weight. |
Source
- React Native: registry/like-button.tsx
- React: registry/web/like-button.tsx and registry/web/like-button.core.ts
Previous: GlossyButton · Next: MorphButton · All components
dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.