BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/snap-cn/caret

UI Caret

snap-cn/caret
FreeComponent

A blinking text caret — a controlled vertical bar, or a pure motion atom that blinks deterministically from useCurrentFrame.

Install it

npx shadcn@latest add https://snapcn.dev/r/caret.json

Source

registry/snap-cn-ui/caret/index.tsxsnapcn.dev/r/caret.json
1"use client";
2
3import type { CSSProperties } from "react";
4import { useCurrentFrame, useVideoConfig } from "remotion";
5
6export interface CaretProps {
7 color?: string;
8 width?: number;
9 height?: number;
10 radius?: number;
11 opacity?: number;
12 blink?: boolean;
13 blinkPerSecond?: number;
14 speed?: number;
15 marginLeft?: number;
16 className?: string;
17 style?: CSSProperties;
18}
19
20export function caretBlinkOpacity(
21 frame: number,
22 opts: { fps: number; blinkPerSecond: number; speed: number },
23): number {
24 const cycles = opts.blinkPerSecond <= 0 ? 1 : opts.blinkPerSecond;
25 const halfPeriod = opts.fps / cycles / 2;
26 if (halfPeriod <= 0) return 1;
27 return Math.floor((frame * opts.speed) / halfPeriod) % 2 === 0 ? 1 : 0;
28}
29
30export function Caret({
31 color = "currentColor",
32 width = 2,
33 height = 18,
34 radius = 1,
35 opacity,
36 blink = false,
37 blinkPerSecond = 1,
38 speed = 1,
39 marginLeft = 0,
40 className,
41 style,
42}: CaretProps) {
43 const frame = useCurrentFrame();
44 const { fps } = useVideoConfig();
45
46 const resolvedOpacity =
47 opacity !== undefined
48 ? opacity
49 : blink
50 ? caretBlinkOpacity(frame, { fps, blinkPerSecond, speed })
51 : 1;
52
53 return (
54 <span
55 className={className}
56 style={{
57 display: "inline-block",
58 flexShrink: 0,
59 width,
60 height,
61 borderRadius: radius,
62 background: color,
63 opacity: resolvedOpacity,
64 marginLeft,
65 ...style,
66 }}
67 />
68 );
69}

What it pulls in

npm packages

  • remotion

Files it writes

  • registry/snap-cn-ui/caret/index.tsx

Facts

Registry
snap-cn
Type
registry:component
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-12
Last confirmed
today

Go to the source

snapcn.dev Raw registry item This item as JSON

More from snap-cn

All 24 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Answer Streamanswer-streamsnap-cnComponentsFree2 deps
Follower Rushfollower-rushsnap-cnComponentsFree2 deps
Product Herohero-launchsnap-cnComponentsFree2 deps
UI Inputinputsnap-cnComponentsFree2 deps · 2 files
Karaoke Captionskaraoke-captionssnap-cnComponentsFree2 deps
Laptop Framelaptop-framesnap-cnComponentsFree1 dep
Logo Assemblelogo-assemblesnap-cnComponentsFree1 dep
Logo Flickerlogo-flickersnap-cnComponentsFree1 dep
BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex