Emoji Reaction
rare-ui/emoji-reactionFreeComponent
A tapback-style reaction button that opens a bar of Apple emoji and sends copies of your pick floating up out of it.
Install it
npx shadcn@latest add https://rareui.com/r/emoji-reaction.jsonSource
1"use client";23import { memo, useCallback, useEffect, useRef, useState } from "react";4import type { ComponentProps, KeyboardEvent } from "react";5import { Slot } from "@radix-ui/react-slot";6import { AnimatePresence, motion, useReducedMotion } from "motion/react";7import { X } from "lucide-react";8import { Emoji, EmojiProvider, type EmojiData } from "react-apple-emojis";9import { cn } from "@/lib/utils";1011// only the default set, the full emoji map ships 380kb of json12const DEFAULT_EMOJI_DATA: EmojiData = {13 baseUrl: "https://em-content.zobj.net/source/apple/419/",14 emojis: {15 "smiling-face-with-hearts": "smiling-face-with-hearts_1f970.png",16 "star-struck": "star-struck_1f929.png",17 "confused-face": "confused-face_1f615.png",18 "pleading-face": "pleading-face_1f97a.png",19 "grinning-face-with-smiling-eyes":20 "grinning-face-with-smiling-eyes_1f604.png",21 },22};2324const DEFAULT_EMOJIS = Object.keys(DEFAULT_EMOJI_DATA.emojis);2526const SURFACE = "bg-[#F4F4F9] dark:bg-[#262626]";2728const BURST_COUNT = 5;29const HOLD_INTERVAL = 550;30const MAX_PARTICLES = 60;31const RISE = 450;32const LAUNCH_SPREAD = 6;33const CLIMB_SPREAD = 78;34// soft ease out, roughly 65% of the distance by the halfway point so it keeps moving35const EASE = [0.4, 0.3, 0.5, 1] as const;36const SWAY = [0, 0.3, 0.65, 1];3738const GAP = 16;39const EDGE = 8;4041const SIZES = {42 sm: {43 trigger: "size-8",44 icon: "size-4",45 emoji: 26,46 pill: "gap-0.5 p-1",47 burst: 26,48 },49 md: {50 trigger: "size-10",51 icon: "size-5",52 emoji: 34,53 pill: "gap-1 p-1.5",54 burst: 34,55 },56 lg: {57 trigger: "size-12",58 icon: "size-6",59 emoji: 42,60 pill: "gap-1.5 p-2",61 burst: 42,62 },63} as const;6465type Align = "left" | "center" | "right";6667type Placement = { side: "top" | "bottom"; shift: number; tailX: number };6869type Particle = {70 id: number;71 name: string;72 originX: number;73 originY: number;74 x: number;75 drift: number;76 tilt: number;77 travel: number;78 scale: number;79 blurRatio: number;80 fadeAt: number;81 duration: number;82 delay: number;83};8485function SmileIcon({ className }: { className?: string }) {86 return (87 <svg viewBox="0 0 24 24" fill="none" aria-hidden className={className}>88 <path89 d="M21 12a9 9 0 1 1-9-9"90 stroke="currentColor"91 strokeWidth="1.7"92 strokeLinecap="round"93 />94 <circle cx="8.9" cy="10" r="1.35" fill="currentColor" />95 <circle cx="15.1" cy="10" r="1.35" fill="currentColor" />96// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from rare-ui
All 13 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Bounce Sidebarbounce-sidebar | rare-ui | Components | Free | 1 dep | |
| Code Blockcode-block | rare-ui | Components | Free | 3 deps | |
| Duration Pickerduration-picker | rare-ui | Components | Free | 5 deps | |
| Family Drawerfamily-drawer | rare-ui | Components | Free | 2 deps | |
| Fluid Orbfluid-orb | rare-ui | Components | Free | no deps | |
| Folder Componentfolder-component | rare-ui | Components | Free | 1 dep | |
| GitHub Activitygithub-activity | rare-ui | Components | Free | 1 dep | |
| Gravity Lettersgravity-letters | rare-ui | Components | Free | no deps |
