shadimage
liquefy-ui
uiliquid-badgesource: ok · hit

LiquidBadge

A small count or status pill for hanging off icons and labels.

npx shadcn add "https://liquefy-ui.com/r/liquid-badge.json"
free

Where it goes

stats

Interaction

animated-counter

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light

Registry dependencies

https://liquefy-ui.com/r/liquefy-ui.jsonhttps://liquefy-ui.com/r/styles-prop.json

Files1 · source cached 10/9/2026, 6:08:33 AM

registry/liquid-badge.tsx
'use client'

import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'
import { useLiquidStyles, type LiquidStyleProps } from '@/lib/styles-prop'

export type LiquidBadgeProps = HTMLAttributes<HTMLSpanElement> & LiquidStyleProps & {
  children?: ReactNode
  count?: number
  dot?: boolean
  max?: number
  showZero?: boolean
  tint?: string
}

export const LiquidBadge = forwardRef<HTMLSpanElement, LiquidBadgeProps>(({
  children,
  className,
  count,
  dot = false,
  max = 99,
  showZero = false,
  style,
  styles,
  tint,
  ...props
}, ref) => {
  const showCount = count !== undefined && (count > 0 || showZero)
  const visible = dot || showCount
  const display = count !== undefined && count > max ? `${max}+` : count
  const root = useLiquidStyles('lq-badge', {
    className,
    style,
    styles,
    vars: tint ? { '--lq-badge-tint': tint } : undefined,
  })

  return (
    <span className={root.className} ref={ref} style={root.style} {...props}>
      {children}
      {visible && (
        <span className="lq-badge__indicator" data-dot={dot}>
          {!dot && display}
        </span>
      )}
    </span>
  )
})

LiquidBadge.displayName = 'LiquidBadge'

More from liquefy-ui

Browse all components in this library →