bg-gradient-to-r Tailwind CSS Class

Gradient right. The generated CSS output is background-image: linear-gradient(to right, var(--tw-gradient-stops)). This page gives you the generated CSS output, a copy-paste example, and an interactive demo for search-friendly utility lookups.

Quick Answer

bg-gradient-to-r maps to background-image: linear-gradient(to right, var(--tw-gradient-stops)). It belongs to the Colors category and was generated from Tailwind CSS v4.1.14 reference data.

Interactive Demo

Toggle the utility on and off, switch preview surfaces, and adjust the demo content to see how this class behaves.

Gradient preview

Tailwind utility preview

This preview simulates the effect of bg-gradient-to-r using structured data generated from your Tailwind reference snapshot.

Visual Comparison

bg-gradient-to-r updates the element's background-image to linear-gradient(to right, var(--tw-gradient-stops)), so the visual emphasis changes without shifting layout or spacing.

Before
Gradient preview

Tailwind utility preview

After
Gradient preview

Tailwind utility preview

background-imageColorscolor

Variants & Breakpoints

Use the base utility directly, then layer state or responsive variants when the component needs more specific behavior.

ContextClass syntaxWhy use itPreview
Basebg-gradient-to-rApply bg-gradient-to-r directly to the element.Default application
Hoverhover:bg-gradient-to-rUse this when the visual change should appear on pointer hover.Pointer state
Focusfocus:bg-gradient-to-rUseful when the class should react to focus or keyboard navigation.Focus state
Darkdark:bg-gradient-to-rApply the same utility inside a dark color scheme.Dark surface

Utility Family Comparison

Compare nearby options and related companions so you can choose the right intensity before reaching for trial-and-error tweaks.

related utility
Border preview

Sample text

border-gray-200
border-color: #e5e7eb
Open utility page ->

When to use this class

Use this class when you want a fast, predictable background-image decision inside colors patterns such as buttons, badges, alerts, or surface accents.

Watch out for

Watch contrast and state stacking. A color utility can look correct in isolation but lose readability once text, border, hover, and dark mode states combine.

Class Reference

FieldValue
Utility classbg-gradient-to-r
CategoryColors
CSS outputbackground-image: linear-gradient(to right, var(--tw-gradient-stops))
Source pageCheat Sheet
Static slugbg-gradient-to-r

Example Snippet

Use this code snippet as a starting point, then swap the markup around it to fit your component or layout.

html
<div class="rounded-lg border border-slate-200 p-4 bg-gradient-to-r">Color preview</div>

Browse More

Return to the Cheat Sheet page for broader browsing, or open the Tailwind CSS Cheat Sheet to move across categories quickly.