Skip to main content

Tailwind CSS Caret Color Cheatsheet

Complete reference for all Tailwind v4 caret-color utilities.
Click each input to see the caret color in action. Click the card to copy the class.

Special Values

Special caret color values for inheriting, matching text color, or hiding the caret.

Basic Colors

Black and white caret colors for simple styling needs.

Color Palette

Caret colors from Tailwind's default color palette at the 500 shade.

Gray Scale

Neutral and gray caret colors for subtle styling.

Common Use Cases

Brand-Colored Inputs

<input
  type="text"
  class="caret-blue-500 border border-gray-300
    focus:border-blue-500 rounded px-3 py-2"
  placeholder="Enter your email"
/>

Dark Mode Inputs

<input
  type="text"
  class="caret-white bg-slate-800
    text-white border border-slate-600
    rounded px-3 py-2"
  placeholder="Dark mode input"
/>

Match Text Color

<input
  type="text"
  class="caret-current text-emerald-600
    border border-emerald-300
    rounded px-3 py-2"
  placeholder="Caret matches text"
/>

Form Validation

{/* Success state */}
<input class="caret-green-500
  border-green-500" />

{/* Error state */}
<input class="caret-red-500
  border-red-500" />

Textarea Styling

<textarea
  class="caret-purple-500 w-full h-32
    border border-gray-300 rounded-lg
    p-3 focus:border-purple-500"
  placeholder="Write something..."
></textarea>

Content Editable

<div
  contenteditable="true"
  class="caret-pink-500 p-4 border
    border-dashed border-gray-300
    rounded-lg min-h-[100px]"
>
  Edit this content...
</div>

Arbitrary Caret Colors

You can use any custom color with Tailwind's arbitrary value syntax:

<input class="caret-[#ff6b6b]" />
<input class="caret-[rgb(255,107,107)]" />
<input class="caret-[hsl(0,100%,71%)]" />

Arbitrary values let you use any valid CSS color format including hex, rgb, hsl, and CSS color names.

Frequently Asked Questions

What is caret-color in Tailwind CSS?

The caret-color utility in Tailwind CSS controls the color of the text insertion cursor (caret) in input fields, textareas, and other editable elements. Classes like caret-red-500 or caret-blue-500 change the cursor color to match your design.

How do I change the caret color in Tailwind CSS?

Add a caret color class to your input element, such as <input class="caret-blue-500">. Tailwind provides caret colors for all palette colors (caret-red-500, caret-green-500, etc.) plus special values like caret-inherit, caret-current, and caret-transparent.

What is the difference between caret-current and caret-inherit?

caret-current sets the caret color to match the element's current text color (currentColor), while caret-inherit inherits the caret color from the parent element. Use caret-current when you want the caret to always match the text color.

Can I make the caret invisible in Tailwind?

Yes, use the caret-transparent class to make the text cursor invisible. This is useful for custom input implementations or when you want to hide the default caret and show a custom cursor instead.

Does caret color work on all input types?

Caret color works on text-based input types (text, email, password, search, url, tel, number) and textareas. It also works on contenteditable elements. It does not affect checkboxes, radio buttons, or select dropdowns.

Can I use arbitrary caret colors in Tailwind?

Yes! Use arbitrary values with the caret utility: caret-[#ff6b6b] or caret-[rgb(255,107,107)]. This lets you use any custom color for the caret.

Quick Reference Table

ClassCSSUse For
caret-inheritcaret-color: inherit;Inherit parent's caret color
caret-currentcaret-color: currentColor;Match current text color
caret-transparentcaret-color: transparent;Hide caret completely
caret-blackcaret-color: #000;Light backgrounds
caret-whitecaret-color: #fff;Dark backgrounds
caret-blue-500caret-color: #3b82f6;Brand-colored inputs
caret-red-500caret-color: #ef4444;Error state inputs
caret-green-500caret-color: #22c55e;Success state inputs