caret-color

Các utility để kiểm soát màu sắc của con trỏ nhập văn bản.

ClassStyles
caret-inherit
caret-color: inherit;
caret-current
caret-color: currentColor;
caret-transparent
caret-color: transparent;
caret-black
caret-color: var(--color-black); /* #000 */
caret-white
caret-color: var(--color-white); /* #fff */
caret-red-50
caret-color: var(--color-red-50); /* oklch(97.1% 0.013 17.38) */
caret-red-100
caret-color: var(--color-red-100); /* oklch(93.6% 0.032 17.717) */
caret-red-200
caret-color: var(--color-red-200); /* oklch(88.5% 0.062 18.334) */
caret-red-300
caret-color: var(--color-red-300); /* oklch(80.8% 0.114 19.571) */
caret-red-400
caret-color: var(--color-red-400); /* oklch(70.4% 0.191 22.216) */

Ví dụ

Ví dụ cơ bản

Sử dụng các utility như caret-rose-500caret-lime-600 để thay đổi màu sắc của con trỏ nhập văn bản:

Focus vào textarea để xem màu caret mới

<textarea class="caret-pink-500 ..."></textarea>

Sử dụng giá trị tùy chỉnh

Use the caret-[<value>] syntax to set the màu caret based on a completely custom value:

<textarea class="caret-[#50d71e] ..."></textarea>

For CSS variables, you can also use the caret-(<custom-property>) syntax:

<textarea class="caret-(--my-caret-color) ..."></textarea>

This is just a shorthand for caret-[var(<custom-property>)] that adds the var() function for you automatically.

Thiết kế responsive

Prefix a caret-color utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<textarea class="caret-rose-500 md:caret-lime-600 ..."></textarea>

Learn more about using variants in the variants documentation.

Tùy chỉnh theme của bạn

Use the --color-* theme variables to customize the color utilities in your project:

@theme {  --color-regal-blue: #243c5a; }

Now the caret-regal-blue utility can be used in your markup:

<textarea class="caret-regal-blue"></textarea>

Learn more about customizing your theme in the theme documentation.

Copyright © 2025 Tailwind Labs Inc.·Chính sách thương hiệu