Circular Metric Glass
shadcn-glass-ui/circular-metric-glassFreeBlock
Compact circular progress metric display optimized for mobile layouts. * Combines CircularProgressGlass with a label for space-efficient metric visualization. * * ## Features
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/circular-metric-glass.jsonSource
1// ========================================2// CIRCULAR METRIC GLASS COMPONENT3// Compact circular metric display for mobile4// ========================================56import { forwardRef } from 'react';7import { cn } from '@/lib/utils';8import {9 CircularProgressGlass,10 type CircularProgressGradient,11} from '../ui/circular-progress-glass';12import '@/glass-theme.css';1314// ========================================15// TYPES16// ========================================1718export type CircularMetricColor = 'emerald' | 'amber' | 'blue' | 'red';1920/**21 * Props for CircularMetricGlass component.22 *23 * Extends standard div attributes for maximum flexibility.24 * All props are readonly to ensure immutability.25 *26 * @example27 * ```tsx28 * const props: CircularMetricGlassProps = {29 * label: 'Reg',30 * value: 84,31 * color: 'emerald',32 * size: 'sm',33 * };34 * ```35 */36export interface CircularMetricGlassProps extends React.HTMLAttributes<HTMLDivElement> {37 /**38 * Metric label displayed below the circular progress indicator.39 *40 * Typically a short abbreviation (2-6 characters) for mobile-friendly display.41 * Examples: "Reg" (Regression), "Imp" (Impact), "Div" (Diversity), "Collab" (Collaboration).42 */43 readonly label: string;4445 /**46 * Metric value as a percentage (0-100).47 *48 * Controls the circular progress fill amount.49 * Displayed as percentage text inside the circle.50 *51 * @example52 * ```tsx53 * <CircularMetricGlass value={84} /> // Shows "84%" at center54 * ```55 */56 readonly value: number;5758 /**59 * Color theme for the metric.60 *61 * Maps to semantic color variants:62 * - `emerald`: Success/positive metrics (--metric-success-*)63 * - `amber`: Warning/moderate metrics (--metric-warning-*)64 * - `blue`: Default/neutral metrics (--metric-default-*)65 * - `red`: Destructive/negative metrics (--metric-destructive-*)66 *67 * @default 'blue'68 */69 readonly color?: CircularMetricColor;7071 /**72 * Size variant of the circular progress indicator.73 *74 * - `sm`: 80px diameter, 6px thickness (mobile-optimized)75 * - `md`: 112px diameter, 8px thickness (desktop/tablet)76 *77 * @default 'sm'78 */79 readonly size?: 'sm' | 'md';80}8182// ========================================83// HELPERS84// ========================================8586// Map CircularMetricColor to CircularProgressGlass gradient and CSS variable87const colorMap: Record<88 CircularMetricColor,89 { gradient: CircularProgressGradient; textVar: string }90> = {91// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Ai Card Glassai-card-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Career Stats Glasscareer-stats-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Career Stats Header Glasscareer-stats-header-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Contribution Metrics Glasscontribution-metrics-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Flags Section Glassflags-section-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Header Branding Glassheader-branding-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Header Nav Glassheader-nav-glass | shadcn-glass-ui | Blocks | Free | no deps | |
| Metric Card Glassmetric-card-glass | shadcn-glass-ui | Blocks | Free | no deps |
