driftkit
ComponentsBadge

Badge

Motion-first badge with multiple variants, icons, pulse animation, and removable functionality. Includes NotificationBadge for counts and status indicators.

Data Display
DefaultSecondarySuccessWarningErrorInfoOutline
SmallMediumLarge
🔥With iconLive statusRemovable

Installation

Copy and paste

Copy the component source code and paste it into your project.

import { Badge, NotificationBadge, AnimatedBadge } from "driftkit";

Props

NameTypeRequiredDescription
variant"default" | "secondary" | "success" | "warning" | "error" | "info" | "outline"NoVisual variant with different background colors and borders. Success is green, error is red, warning is amber, etc.
size"sm" | "md" | "lg"NoBadge size affecting padding and text size.
iconReactNodeNoOptional icon displayed before the text. Automatically sized based on badge size.
pulsebooleanNoShows animated pulse dot for live status indicators.
removablebooleanNoShows remove button (×) with hover effects. Use with onRemove callback.
onRemove() => voidNoCallback when remove button is clicked. Only works when removable is true.
childrenReactNodeYesBadge content - typically short text or numbers.
🎮

Playground

Tune spring physics for this component

Live Preview

🔔
3

Spring Physics

300
30
1

Generated Code

const springConfig = {
  "type": "spring",
  "stiffness": 300,
  "damping": 30,
  "mass": 1
};

// Basic hover animation
<motion.div
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  transition={springConfig}
>
  <Badge />
</motion.div>

// Advanced with custom animations
<motion.div
  animate={{ 
    scale: [1, 1.02, 1],
    y: [0, -4, 0]
  }}
  transition={{
    ...springConfig,
    repeat: Infinity,
    repeatDelay: 2
  }}
>
  <Badge />
</motion.div>
Stiffness: Controls animation speed. Higher values create snappier animations.
Damping: Controls resistance to motion. Lower values create more bounce and overshoot.
Mass: Controls the perceived weight. Higher values make animations slower with more momentum.

Source Code

View the source code on GitHub to see the full implementation.

View on GitHub