Browse documentation

Reference / Interactivity

Caret color

Choose the color of the text insertion caret independently of the surrounding text color.

Working example

Focus the field to see the caret. Choose a color that remains visible against the field background as the user types.

HTML
<label class="block">Running title
  <input class="mt-1 block w-full border bg-neutral-900 p-2 text-white caret-white" value="Collected editions">
</label>

Class reference

ClassCSS declarations
caret-blackcaret-color: #000;
caret-whitecaret-color: #fff;
caret-currentcaret-color: currentColor;
caret-neutral-600caret-color: oklch(0.56 0 0);
View full generated CSS
Compiled CSS
.caret-black {
  caret-color: #000;
}
.caret-current {
  caret-color: currentColor;
}
.caret-neutral-600 {
  caret-color: oklch(0.56 0 0);
}
.caret-white {
  caret-color: #fff;
}