Class reference
Usage
Control the text color of an element using the .text-{color}
utilities.
Responsive
To control the text color of an element at a specific breakpoint, add a {screen}:
prefix to any existing text color utility. For example, use md:text-green
to apply the text-green
utility at only medium screen sizes and above.
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
all
sm
md
lg
xl
Hover
To control the text color of an element on hover, add the hover:
prefix to any existing text color utility. For example, use hover:text-blue
to apply the text-blue
utility on hover.
Hover utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the hover:
prefix.
<button class="... md:text-blue md:hover:text-blue-dark ...">Button</button>
Focus
To control the text color of an element on focus, add the focus:
prefix to any existing text color utility. For example, use focus:text-blue
to apply the text-blue
utility on focus.
Focus utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the focus:
prefix.
<input class="... md:text-black md:focus:text-red ...">
Customizing
Text Colors
By default Tailwind makes the entire default color palette available as text colors.
You can customize your color palette by editing the colors
variable in your Tailwind config file, or customize just your text colors using the textColors
section of your Tailwind config.
Responsive and State Variants
By default, only responsive, hover and focus variants are generated for text color utilities.
You can control which variants are generated for the text color utilities by modifying the textColors
property in the modules
section of your Tailwind config file.
For example, this config will also generate variants:
Disabling
If you don’t plan to use the text color utilities in your project, you can disable them entirely by setting the textColors
property to false
in the modules
section of your config file: