For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
/
144
Sponsor

Caret

A blinking text caret — a controlled vertical bar or a self-animating blink.

Type something
Customize
1
28
1
3

Installation

$ pnpm dlx shadcn@latest add @framecn/caret

Usage

Controlled — the consumer decides visibility:

import { Caret } from "@/components/ui/caret";
 
<Caret color="#1F1E1D" height={24} opacity={typing ? 1 : 0} />;

Standalone blink — a self-animating caret driven by useCurrentFrame():

import { Caret } from "@/components/ui/caret";
 
<Caret blink blinkPerSecond={1} height={28} />;

The docs preview shows a blinking caret after placeholder text, matching remocn’s preview scene.

visible = floor(frame × speed / halfPeriod) is even
halfPeriod = fps / blinkPerSecond / 2

When opacity is provided it always wins; otherwise blink drives the bar, and with neither the caret stays solid.

API Reference

Caret

PropTypeDefault
colorstring"currentColor"
widthnumber2
heightnumber18
radiusnumber1
opacitynumber- (overrides blink)
blinkbooleanfalse
blinkPerSecondnumber1
speednumber1
marginLeftnumber0
classNamestring-
styleCSSProperties-