Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Charts and metrics
Tick Bar
Progress drawn as a row of ticks.
import { TickBar } from "@/registry/vcare/ui/tick-bar"
export default function TickBarDemo() {
return (
<div className="mx-auto max-w-sm space-y-4">
<TickBar value={68} />
<TickBar value={40} shape="pill" segments={12} color="var(--chart-2)" />
</div>
)
}Installation
npx shadcn@latest add @vcare/tick-barOr install directly from the URL: https://ui.vcarehms.com/r/tick-bar.json
- Add the registry items it uses: utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/tick-bar.tsx
import * as React from 'react';
import { cn } from '@/registry/vcare/lib/utils';
export interface TickBarProps extends React.ComponentProps<'div'> {
/** Current value, from 0 to max. */
value: number;
max?: number;
/** Number of ticks. */
segments?: number;
/** Any CSS color for the filled ticks. Defaults to chart-1. */
color?: string;
/** Any CSS color for the unfilled ticks. Defaults to muted. */
trackColor?: string;
/** "tick" draws thin bars; "pill" draws wide rounded ones. */
shape?: 'tick' | 'pill';
/** Reveal filled ticks in sequence when the bar mounts. */
animate?: boolean;
/** Total reveal time in milliseconds. */
animationDuration?: number;
}
/** A progress bar drawn as a row of ticks, lit up to the current value. */
function TickBar({
value,
max = 100,
segments = 40,
color = 'var(--chart-1)',
trackColor,
shape = 'tick',
animate = false,
animationDuration = 700,
className,
...props
}: TickBarProps) {
const fraction = Math.min(1, Math.max(0, value / (max || 1)));
// Any non-zero value lights at least one tick so small values still register.
const filled = fraction === 0 ? 0 : Math.max(1, Math.round(fraction * segments));
return (
<div
data-slot="tick-bar"
data-shape={shape}
role="progressbar"
aria-valuemin={0}
aria-valuemax={max}
aria-valuenow={value}
className={cn('flex w-full', shape === 'tick' ? 'h-6 gap-[3px]' : 'h-4 gap-1.5', className)}
{...props}
>
{Array.from({ length: segments }, (_, index) => {
const lit = index < filled;
return (
<span
key={index}
data-filled={lit}
className={cn(
'bg-muted relative h-full min-w-0 flex-1 overflow-hidden transition-colors',
shape === 'tick' ? 'rounded-[1.5px]' : 'rounded-full',
)}
style={{ backgroundColor: trackColor }}
>
{lit ? (
<span
className={cn(
'absolute inset-0',
shape === 'tick' ? 'rounded-[1.5px]' : 'rounded-full',
animate && 'motion-safe:animate-in motion-safe:fade-in',
)}
style={{
backgroundColor: color,
...(animate
? {
animationDelay: `${(index / Math.max(1, filled)) * animationDuration * 0.8}ms`,
animationDuration: `${Math.max(120, animationDuration * 0.25)}ms`,
animationFillMode: 'both',
}
: null),
}}
/>
) : null}
</span>
);
})}
</div>
);
}
export { TickBar };Usage
import { TickBar } from "@/components/ui/tick-bar"Exports
TickBar
Dependencies
@vcare/utils(registry)
Raw item: /r/tick-bar.json