pnpm dlx shadcn@latest add @gammaui/usage-card
import { IconCpu } from "@tabler/icons-react"
import { UsageCard } from "@/components/ui/usage-card"
export default function Example() {
return (
<UsageCard
title="CPU"
percentage={72}
pillCount={10}
accentColor="#00f5ff"
icon={<IconCpu size={13} />}
/>
)
}| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | Label shown on the top-left of the card. |
| percentage | number | — | Current usage value from 0 to 100. |
| pillCount | number | 10 | How many pill segments to render across the card. |
| accentColor | string | #00f5ff | Neon glow color for active pills and the percentage counter. |
| icon | ReactNode | — | Optional icon rendered next to the title (use Tabler Icons). |
#ff2d55) when usage exceeds 75%motion/react) and Tabler Icons"use client" compatible for Next.js App Routerimport { IconServer } from "@tabler/icons-react"
import { UsageCard } from "@/components/ui/usage-card"
export default function Example() {
return (
<UsageCard
title="Memory"
percentage={45}
pillCount={10}
accentColor="#bf5af2"
icon={<IconServer size={13} />}
/>
)
}"use client"
import { useEffect, useState } from "react"
import { IconCpu, IconDatabase, IconServer } from "@tabler/icons-react"
import { UsageCard } from "@/components/ui/usage-card"
export default function Dashboard() {
const [cpu, setCpu] = useState(40)
const [ram, setRam] = useState(55)
const [disk, setDisk] = useState(80)
useEffect(() => {
const id = setInterval(() => {
setCpu((v) => Math.min(100, Math.max(0, v + (Math.random() - 0.5) * 10)))
setRam((v) => Math.min(100, Math.max(0, v + (Math.random() - 0.5) * 6)))
setDisk((v) => Math.min(100, Math.max(0, v + (Math.random() - 0.48) * 2)))
}, 2000)
return () => clearInterval(id)
}, [])
return (
<div className="flex flex-col gap-4">
<UsageCard
title="CPU"
percentage={Math.round(cpu)}
accentColor="#00f5ff"
icon={<IconCpu size={13} />}
/>
<UsageCard
title="Memory"
percentage={Math.round(ram)}
accentColor="#bf5af2"
icon={<IconServer size={13} />}
/>
<UsageCard
title="Disk"
percentage={Math.round(disk)}
accentColor="#ff9f0a"
icon={<IconDatabase size={13} />}
/>
</div>
)
}pillCount lower (e.g. 5) for a chunkier, bolder look.