Menu

Tailwind CSS Accent Color

The Accent Color is a CSS property used to style interactive controls, such as checkboxes, radio buttons, and progress bars. It allows you to change the design from the default browser-defined appearance to something that reflects the visual identity of your website.

Tailwind CSS extends support to the accent-color property, providing utility classes that make it easy to integrate and modify during development. In this guide, we'll explore how to effectively utilize the Accent Color feature using Tailwind CSS.

ClassPropertiesExample
accent-inheritaccent-color: inherit;<div className="accent-inherit"></div>
accent-currentaccent-color: currentColor;<div className="accent-current"></div>
accent-transparentaccent-color: transparent;<div className="accent-transparent"></div>
accent-blackaccent-color: #000;<div className="accent-black"></div>
accent-whiteaccent-color: #fff;<div className="accent-white"></div>
accent-slate-50accent-color: #f8fafc;<div className="accent-slate-50"></div>
accent-slate-100accent-color: #f1f5f9;<div className="accent-slate-100"></div>
accent-slate-200accent-color: #e2e8f0;<div className="accent-slate-200"></div>
accent-slate-300accent-color: #cbd5e1;<div className="accent-slate-300"></div>
accent-slate-400accent-color: #94a3b8;<div className="accent-slate-400"></div>
accent-slate-500accent-color: #64748b;<div className="accent-slate-500"></div>
accent-slate-600accent-color: #475569;<div className="accent-slate-600"></div>
accent-slate-700accent-color: #334155;<div className="accent-slate-700"></div>
accent-slate-800accent-color: #1e293b;<div className="accent-slate-800"></div>
accent-slate-900accent-color: #0f172a;<div className="accent-slate-900"></div>
accent-slate-950accent-color: #020617;<div className="accent-slate-950"></div>
accent-gray-50accent-color: #f9fafb;<div className="accent-gray-50"></div>
accent-gray-100accent-color: #f3f4f6;<div className="accent-gray-100"></div>
accent-gray-200accent-color: #e5e7eb;<div className="accent-gray-200"></div>
accent-gray-300accent-color: #d1d5db;<div className="accent-gray-300"></div>
accent-gray-400accent-color: #9ca3af;<div className="accent-gray-400"></div>
accent-gray-500accent-color: #6b7280;<div className="accent-gray-500"></div>
accent-gray-600accent-color: #4b5563;<div className="accent-gray-600"></div>
accent-gray-700accent-color: #374151;<div className="accent-gray-700"></div>
accent-gray-800accent-color: #1f2937;<div className="accent-gray-800"></div>
accent-gray-900accent-color: #111827;<div className="accent-gray-900"></div>
accent-gray-950accent-color: #030712;<div className="accent-gray-950"></div>
accent-zinc-50accent-color: #fafafa;<div className="accent-zinc-50"></div>
accent-zinc-100accent-color: #f4f4f5;<div className="accent-zinc-100"></div>
accent-zinc-200accent-color: #e4e4e7;<div className="accent-zinc-200"></div>
accent-zinc-300accent-color: #d4d4d8;<div className="accent-zinc-300"></div>
accent-zinc-400accent-color: #a1a1aa;<div className="accent-zinc-400"></div>
accent-zinc-500accent-color: #71717a;<div className="accent-zinc-500"></div>
accent-zinc-600accent-color: #52525b;<div className="accent-zinc-600"></div>
accent-zinc-700accent-color: #3f3f46;<div className="accent-zinc-700"></div>
accent-zinc-800accent-color: #27272a;<div className="accent-zinc-800"></div>
accent-zinc-900accent-color: #18181b;<div className="accent-zinc-900"></div>
accent-zinc-950accent-color: #09090b;<div className="accent-zinc-950"></div>
accent-neutral-50accent-color: #fafafa;<div className="accent-neutral-50"></div>
accent-neutral-100accent-color: #f5f5f5;<div className="accent-neutral-100"></div>
accent-neutral-200accent-color: #e5e5e5;<div className="accent-neutral-200"></div>
accent-neutral-300accent-color: #d4d4d4;<div className="accent-neutral-300"></div>
accent-neutral-400accent-color: #a3a3a3;<div className="accent-neutral-400"></div>
accent-neutral-500accent-color: #737373;<div className="accent-neutral-500"></div>
accent-neutral-600accent-color: #525252;<div className="accent-neutral-600"></div>
accent-neutral-700accent-color: #404040;<div className="accent-neutral-700"></div>
accent-neutral-800accent-color: #262626;<div className="accent-neutral-800"></div>
accent-neutral-900accent-color: #171717;<div className="accent-neutral-900"></div>
accent-neutral-950accent-color: #0a0a0a;<div className="accent-neutral-950"></div>
accent-stone-50accent-color: #fafaf9;<div className="accent-stone-50"></div>
accent-stone-100accent-color: #f5f5f4;<div className="accent-stone-100"></div>
accent-stone-200accent-color: #e7e5e4;<div className="accent-stone-200"></div>
accent-stone-300accent-color: #d6d3d1;<div className="accent-stone-300"></div>
accent-stone-400accent-color: #a8a29e;<div className="accent-stone-400"></div>
accent-stone-500accent-color: #78716c;<div className="accent-stone-500"></div>
accent-stone-600accent-color: #57534e;<div className="accent-stone-600"></div>
accent-stone-700accent-color: #44403c;<div className="accent-stone-700"></div>
accent-stone-800accent-color: #292524;<div className="accent-stone-800"></div>
accent-stone-900accent-color: #1c1917;<div className="accent-stone-900"></div>
accent-stone-950accent-color: #0c0a09;<div className="accent-stone-950"></div>
accent-red-50accent-color: #fef2f2;<div className="accent-red-50"></div>
accent-red-100accent-color: #fee2e2;<div className="accent-red-100"></div>
accent-red-200accent-color: #fecaca;<div className="accent-red-200"></div>
accent-red-300accent-color: #fca5a5;<div className="accent-red-300"></div>
accent-red-400accent-color: #f87171;<div className="accent-red-400"></div>
accent-red-500accent-color: #ef4444;<div className="accent-red-500"></div>
accent-red-600accent-color: #dc2626;<div className="accent-red-600"></div>
accent-red-700accent-color: #b91c1c;<div className="accent-red-700"></div>
accent-red-800accent-color: #991b1b;<div className="accent-red-800"></div>
accent-red-900accent-color: #7f1d1d;<div className="accent-red-900"></div>
accent-red-950accent-color: #450a0a;<div className="accent-red-950"></div>
accent-orange-50accent-color: #fff7ed;<div className="accent-orange-50"></div>
accent-orange-100accent-color: #ffedd5;<div className="accent-orange-100"></div>
accent-orange-200accent-color: #fed7aa;<div className="accent-orange-200"></div>
accent-orange-300accent-color: #fdba74;<div className="accent-orange-300"></div>
accent-orange-400accent-color: #fb923c;<div className="accent-orange-400"></div>
accent-orange-500accent-color: #f97316;<div className="accent-orange-500"></div>
accent-orange-600accent-color: #ea580c;<div className="accent-orange-600"></div>
accent-orange-700accent-color: #c2410c;<div className="accent-orange-700"></div>
accent-orange-800accent-color: #9a3412;<div className="accent-orange-800"></div>
accent-orange-900accent-color: #7c2d12;<div className="accent-orange-900"></div>
accent-orange-950accent-color: #431407;<div className="accent-orange-950"></div>
accent-amber-50accent-color: #fffbeb;<div className="accent-amber-50"></div>
accent-amber-100accent-color: #fef3c7;<div className="accent-amber-100"></div>
accent-amber-200accent-color: #fde68a;<div className="accent-amber-200"></div>
accent-amber-300accent-color: #fcd34d;<div className="accent-amber-300"></div>
accent-amber-400accent-color: #fbbf24;<div className="accent-amber-400"></div>
accent-amber-500accent-color: #f59e0b;<div className="accent-amber-500"></div>
accent-amber-600accent-color: #d97706;<div className="accent-amber-600"></div>
accent-amber-700accent-color: #b45309;<div className="accent-amber-700"></div>
accent-amber-800accent-color: #92400e;<div className="accent-amber-800"></div>
accent-amber-900accent-color: #78350f;<div className="accent-amber-900"></div>
accent-amber-950accent-color: #451a03;<div className="accent-amber-950"></div>
accent-yellow-50accent-color: #fefce8;<div className="accent-yellow-50"></div>
accent-yellow-100accent-color: #fef9c3;<div className="accent-yellow-100"></div>
accent-yellow-200accent-color: #fef08a;<div className="accent-yellow-200"></div>
accent-yellow-300accent-color: #fde047;<div className="accent-yellow-300"></div>
accent-yellow-400accent-color: #facc15;<div className="accent-yellow-400"></div>
accent-yellow-500accent-color: #eab308;<div className="accent-yellow-500"></div>
accent-yellow-600accent-color: #ca8a04;<div className="accent-yellow-600"></div>
accent-yellow-700accent-color: #a16207;<div className="accent-yellow-700"></div>
accent-yellow-800accent-color: #854d0e;<div className="accent-yellow-800"></div>
accent-yellow-900accent-color: #713f12;<div className="accent-yellow-900"></div>
accent-yellow-950accent-color: #422006;<div className="accent-yellow-950"></div>
accent-lime-50accent-color: #f7fee7;<div className="accent-lime-50"></div>
accent-lime-100accent-color: #ecfccb;<div className="accent-lime-100"></div>
accent-lime-200accent-color: #d9f99d;<div className="accent-lime-200"></div>
accent-lime-300accent-color: #bef264;<div className="accent-lime-300"></div>
accent-lime-400accent-color: #a3e635;<div className="accent-lime-400"></div>
accent-lime-500accent-color: #84cc16;<div className="accent-lime-500"></div>
accent-lime-600accent-color: #65a30d;<div className="accent-lime-600"></div>
accent-lime-700accent-color: #4d7c0f;<div className="accent-lime-700"></div>
accent-lime-800accent-color: #3f6212;<div className="accent-lime-800"></div>
accent-lime-900accent-color: #365314;<div className="accent-lime-900"></div>
accent-lime-950accent-color: #1a2e05;<div className="accent-lime-950"></div>
accent-green-50accent-color: #f0fdf4;<div className="accent-green-50"></div>
accent-green-100accent-color: #dcfce7;<div className="accent-green-100"></div>
accent-green-200accent-color: #bbf7d0;<div className="accent-green-200"></div>
accent-green-300accent-color: #86efac;<div className="accent-green-300"></div>
accent-green-400accent-color: #4ade80;<div className="accent-green-400"></div>
accent-green-500accent-color: #22c55e;<div className="accent-green-500"></div>
accent-green-600accent-color: #16a34a;<div className="accent-green-600"></div>
accent-green-700accent-color: #15803d;<div className="accent-green-700"></div>
accent-green-800accent-color: #166534;<div className="accent-green-800"></div>
accent-green-900accent-color: #14532d;<div className="accent-green-900"></div>
accent-green-950accent-color: #052e16;<div className="accent-green-950"></div>
accent-emerald-50accent-color: #ecfdf5;<div className="accent-emerald-50"></div>
accent-emerald-100accent-color: #d1fae5;<div className="accent-emerald-100"></div>
accent-emerald-200accent-color: #a7f3d0;<div className="accent-emerald-200"></div>
accent-emerald-300accent-color: #6ee7b7;<div className="accent-emerald-300"></div>
accent-emerald-400accent-color: #34d399;<div className="accent-emerald-400"></div>
accent-emerald-500accent-color: #10b981;<div className="accent-emerald-500"></div>
accent-emerald-600accent-color: #059669;<div className="accent-emerald-600"></div>
accent-emerald-700accent-color: #047857;<div className="accent-emerald-700"></div>
accent-emerald-800accent-color: #065f46;<div className="accent-emerald-800"></div>
accent-emerald-900accent-color: #064e3b;<div className="accent-emerald-900"></div>
accent-emerald-950accent-color: #022c22;<div className="accent-emerald-950"></div>
accent-teal-50accent-color: #f0fdfa;<div className="accent-teal-50"></div>
accent-teal-100accent-color: #ccfbf1;<div className="accent-teal-100"></div>
accent-teal-200accent-color: #99f6e4;<div className="accent-teal-200"></div>
accent-teal-300accent-color: #5eead4;<div className="accent-teal-300"></div>
accent-teal-400accent-color: #2dd4bf;<div className="accent-teal-400"></div>
accent-teal-500accent-color: #14b8a6;<div className="accent-teal-500"></div>
accent-teal-600accent-color: #0d9488;<div className="accent-teal-600"></div>
accent-teal-700accent-color: #0f766e;<div className="accent-teal-700"></div>
accent-teal-800accent-color: #115e59;<div className="accent-teal-800"></div>
accent-teal-900accent-color: #134e4a;<div className="accent-teal-900"></div>
accent-teal-950accent-color: #042f2e;<div className="accent-teal-950"></div>
accent-cyan-50accent-color: #ecfeff;<div className="accent-cyan-50"></div>
accent-cyan-100accent-color: #cffafe;<div className="accent-cyan-100"></div>
accent-cyan-200accent-color: #a5f3fc;<div className="accent-cyan-200"></div>
accent-cyan-300accent-color: #67e8f9;<div className="accent-cyan-300"></div>
accent-cyan-400accent-color: #22d3ee;<div className="accent-cyan-400"></div>
accent-cyan-500accent-color: #06b6d4;<div className="accent-cyan-500"></div>
accent-cyan-600accent-color: #0891b2;<div className="accent-cyan-600"></div>
accent-cyan-700accent-color: #0e7490;<div className="accent-cyan-700"></div>
accent-cyan-800accent-color: #155e75;<div className="accent-cyan-800"></div>
accent-cyan-900accent-color: #164e63;<div className="accent-cyan-900"></div>
accent-cyan-950accent-color: #083344;<div className="accent-cyan-950"></div>
accent-sky-50accent-color: #f0f9ff;<div className="accent-sky-50"></div>
accent-sky-100accent-color: #e0f2fe;<div className="accent-sky-100"></div>
accent-sky-200accent-color: #bae6fd;<div className="accent-sky-200"></div>
accent-sky-300accent-color: #7dd3fc;<div className="accent-sky-300"></div>
accent-sky-400accent-color: #38bdf8;<div className="accent-sky-400"></div>
accent-sky-500accent-color: #0ea5e9;<div className="accent-sky-500"></div>
accent-sky-600accent-color: #0284c7;<div className="accent-sky-600"></div>
accent-sky-700accent-color: #0369a1;<div className="accent-sky-700"></div>
accent-sky-800accent-color: #075985;<div className="accent-sky-800"></div>
accent-sky-900accent-color: #0c4a6e;<div className="accent-sky-900"></div>
accent-sky-950accent-color: #082f49;<div className="accent-sky-950"></div>
accent-blue-50accent-color: #eff6ff;<div className="accent-blue-50"></div>
accent-blue-100accent-color: #dbeafe;<div className="accent-blue-100"></div>
accent-blue-200accent-color: #bfdbfe;<div className="accent-blue-200"></div>
accent-blue-300accent-color: #93c5fd;<div className="accent-blue-300"></div>
accent-blue-400accent-color: #60a5fa;<div className="accent-blue-400"></div>
accent-blue-500accent-color: #3b82f6;<div className="accent-blue-500"></div>
accent-blue-600accent-color: #2563eb;<div className="accent-blue-600"></div>
accent-blue-700accent-color: #1d4ed8;<div className="accent-blue-700"></div>
accent-blue-800accent-color: #1e40af;<div className="accent-blue-800"></div>
accent-blue-900accent-color: #1e3a8a;<div className="accent-blue-900"></div>
accent-blue-950accent-color: #172554;<div className="accent-blue-950"></div>
accent-indigo-50accent-color: #eef2ff;<div className="accent-indigo-50"></div>
accent-indigo-100accent-color: #e0e7ff;<div className="accent-indigo-100"></div>
accent-indigo-200accent-color: #c7d2fe;<div className="accent-indigo-200"></div>
accent-indigo-300accent-color: #a5b4fc;<div className="accent-indigo-300"></div>
accent-indigo-400accent-color: #818cf8;<div className="accent-indigo-400"></div>
accent-indigo-500accent-color: #6366f1;<div className="accent-indigo-500"></div>
accent-indigo-600accent-color: #4f46e5;<div className="accent-indigo-600"></div>
accent-indigo-700accent-color: #4338ca;<div className="accent-indigo-700"></div>
accent-indigo-800accent-color: #3730a3;<div className="accent-indigo-800"></div>
accent-indigo-900accent-color: #312e81;<div className="accent-indigo-900"></div>
accent-indigo-950accent-color: #1e1b4b;<div className="accent-indigo-950"></div>
accent-violet-50accent-color: #f5f3ff;<div className="accent-violet-50"></div>
accent-violet-100accent-color: #ede9fe;<div className="accent-violet-100"></div>
accent-violet-200accent-color: #ddd6fe;<div className="accent-violet-200"></div>
accent-violet-300accent-color: #c4b5fd;<div className="accent-violet-300"></div>
accent-violet-400accent-color: #a78bfa;<div className="accent-violet-400"></div>
accent-violet-500accent-color: #8b5cf6;<div className="accent-violet-500"></div>
accent-violet-600accent-color: #7c3aed;<div className="accent-violet-600"></div>
accent-violet-700accent-color: #6d28d9;<div className="accent-violet-700"></div>
accent-violet-800accent-color: #5b21b6;<div className="accent-violet-800"></div>
accent-violet-900accent-color: #4c1d95;<div className="accent-violet-900"></div>
accent-violet-950accent-color: #2e1065;<div className="accent-violet-950"></div>
accent-purple-50accent-color: #faf5ff;<div className="accent-purple-50"></div>
accent-purple-100accent-color: #f3e8ff;<div className="accent-purple-100"></div>
accent-purple-200accent-color: #e9d5ff;<div className="accent-purple-200"></div>
accent-purple-300accent-color: #d8b4fe;<div className="accent-purple-300"></div>
accent-purple-400accent-color: #c084fc;<div className="accent-purple-400"></div>
accent-purple-500accent-color: #a855f7;<div className="accent-purple-500"></div>
accent-purple-600accent-color: #9333ea;<div className="accent-purple-600"></div>
accent-purple-700accent-color: #7e22ce;<div className="accent-purple-700"></div>
accent-purple-800accent-color: #6b21a8;<div className="accent-purple-800"></div>
accent-purple-900accent-color: #581c87;<div className="accent-purple-900"></div>
accent-purple-950accent-color: #3b0764;<div className="accent-purple-950"></div>
accent-fuchsia-50accent-color: #fdf4ff;<div className="accent-fuchsia-50"></div>
accent-fuchsia-100accent-color: #fae8ff;<div className="accent-fuchsia-100"></div>
accent-fuchsia-200accent-color: #f5d0fe;<div className="accent-fuchsia-200"></div>
accent-fuchsia-300accent-color: #f0abfc;<div className="accent-fuchsia-300"></div>
accent-fuchsia-400accent-color: #e879f9;<div className="accent-fuchsia-400"></div>
accent-fuchsia-500accent-color: #d946ef;<div className="accent-fuchsia-500"></div>
accent-fuchsia-600accent-color: #c026d3;<div className="accent-fuchsia-600"></div>
accent-fuchsia-700accent-color: #a21caf;<div className="accent-fuchsia-700"></div>
accent-fuchsia-800accent-color: #86198f;<div className="accent-fuchsia-800"></div>
accent-fuchsia-900accent-color: #701a75;<div className="accent-fuchsia-900"></div>
accent-fuchsia-950accent-color: #4a044e;<div className="accent-fuchsia-950"></div>
accent-pink-50accent-color: #fdf2f8;<div className="accent-pink-50"></div>
accent-pink-100accent-color: #fce7f3;<div className="accent-pink-100"></div>
accent-pink-200accent-color: #fbcfe8;<div className="accent-pink-200"></div>
accent-pink-300accent-color: #f9a8d4;<div className="accent-pink-300"></div>
accent-pink-400accent-color: #f472b6;<div className="accent-pink-400"></div>
accent-pink-500accent-color: #ec4899;<div className="accent-pink-500"></div>
accent-pink-600accent-color: #db2777;<div className="accent-pink-600"></div>
accent-pink-700accent-color: #be185d;<div className="accent-pink-700"></div>
accent-pink-800accent-color: #9d174d;<div className="accent-pink-800"></div>
accent-pink-900accent-color: #831843;<div className="accent-pink-900"></div>
accent-pink-950accent-color: #500724;<div className="accent-pink-950"></div>
accent-rose-50accent-color: #fff1f2;<div className="accent-rose-50"></div>
accent-rose-100accent-color: #ffe4e6;<div className="accent-rose-100"></div>
accent-rose-200accent-color: #fecdd3;<div className="accent-rose-200"></div>
accent-rose-300accent-color: #fda4af;<div className="accent-rose-300"></div>
accent-rose-400accent-color: #fb7185;<div className="accent-rose-400"></div>
accent-rose-500accent-color: #f43f5e;<div className="accent-rose-500"></div>
accent-rose-600accent-color: #e11d48;<div className="accent-rose-600"></div>
accent-rose-700accent-color: #be123c;<div className="accent-rose-700"></div>
accent-rose-800accent-color: #9f1239;<div className="accent-rose-800"></div>
accent-rose-900accent-color: #881337;<div className="accent-rose-900"></div>
accent-rose-950accent-color: #4c0519;<div className="accent-rose-950"></div>
accent-autoaccent-color: auto;<div className="accent-auto"></div>

Overview of Accent Color

The accent-color property in CSS allows you to update the internal style for certain form elements, replacing the default color.

Adding the Accent Color

You can assign an accent color to components like checkboxes and radio buttons using accent utilities- accent-color-value, e.g., accent-rose-600, accent-pink-600, etc.

This is a live editor. Play around with it!
export default function AccentColorDemo() {
  return (
    <div className="w-screen h-screen flex flex-col items-center justify-center gap-4">
      {/* Checkbox with teal accent color */}
      <label>
        <input type="checkbox" className="accent-teal-500 mr-4" />
        Custom Checkbox
      </label>

      {/* Radio button showcasing purple accent */}
      <label>
        <input type="radio" className="accent-purple-500 mr-4" />
        Custom Radio Button
      </label>
    </div>
  );
}

Adjusting the Opacity

Tailwind provide direct opacity modifiers that you can append to accent-* classes, e.g., accent-red-700/50. However, the browser support for it is limited. Therefore, we recommend you to use the opacity-* classes to change the opacity of the accent color.

This is a live editor. Play around with it!
export default function AccentWithOpacity() {
  return (
    <div className="w-screen h-screen flex flex-col items-center justify-center gap-4">
      {/* Checkbox with 50% opacity */}
      <label>
        <input type="checkbox" className="accent-teal-500 opacity-50 mr-4" />
        Custom Checkbox
      </label>

      {/* Radio button with 75% opacity */}
      <label>
        <input type="radio" className="accent-purple-500 opacity-75 mr-4" />
        Custom Radio Button
      </label>
    </div>
  );
}

States and Responsiveness

Hover and Focus States

Using modifiers like hover or focus, you can define different accent features for interactive states.

This is a live editor. Play around with it!
export default function AccentHoverFocus() {
  return (
    <div className="w-screen h-screen flex flex-col items-center justify-center gap-4">
      {/* Checkbox with dark teal accent color on hover */}
      <label>
        <input type="checkbox" className="accent-teal-500 hover:accent-teal-800 mr-4" />
        Custom Checkbox
      </label>

      {/* Radio button with accent color on hover */}
      <label>
        <input type="radio" className="accent-purple-500 hover:accent-purple-800 mr-4" />
        Custom Radio Button
      </label>
    </div>
  );
}

Breakpoint Modifers

Using responsive modifiers alongside accent utilities grants you greater control over styling. Below is an interactive checkbox form that has three radio buttons with different accent color as per the screen size:

This is a live editor. Play around with it!
export default function ResponsiveAccentColor() {
  return (
    <div className="w-screen h-screen bg-gradient-to-r from-yellow-50 to-yellow-200 flex flex-col items-start gap-2 p-6">
      <label>
        {/* Small screens = Red accent */}
        <input type="radio" className="sm:accent-red-400" /> Red accent color on 'sm' devices
      </label>

      <label>
        {/* Medium devices = Sky accent */}
        <input type="radio" className="md:accent-sky-500" /> Sky accent color on 'md' devices
      </label>

      <label>
        {/* Large screens = Blue accent */}
        <input type="radio" className="lg:accent-blue-600" /> Blue accent color on 'lg' devices
      </label>
    </div>
  );
}

Custom Accent Color

There may arise scenarios where you’d prefer custom color schemes or accents that deviate from the default palette. Tailwind's theme extension capability and arbitrary value support make this process seamless.

Extending the Theme

You can extend the Tailwind config to include entirely new accent shades. Add a custom entry to the theme.extend section in your tailwind.config.js file, like so:

Now that you've declared Custom Lavender colors, they can be accessed as accent utilities:

This is a live editor. Play around with it!
import tailwindConfig from "./tailwind.config.js";
tailwind.config = tailwindConfig;

export default function CustomAccent() {
  return (
    <div className="w-screen h-screen bg-gray-100 flex flex-col items-center justify-center space-y-4">
      <label>
        <input type="checkbox" className="accent-new mr-4" />
        Custom Checkbox
      </label>
      <label>
        <input type="radio" className="accent-new mr-4" />
        Custom Radio Button
      </label>
    </div>
  );
}

Using Arbitrary Values

Tailwind allows incredibly granular design changes via classes using arbitrary values. You can define hex, RGB, or HSL values instead of relying solely on predefined colors.

This is a live editor. Play around with it!
export default function ArbitraryAccentColors() {
  return (
    <div className="w-screen h-screen bg-gray-100 flex flex-col items-center justify-center space-y-4">
      <label>
        <input type="checkbox" className="accent-[#36c4c5] mr-4" />
        Custom Checkbox
      </label>
      <label>
        <input type="radio" className="accent-[#36c4c5] mr-4" />
        Custom Radio Button
      </label>
    </div>
  );
}

Real World Examples

Product Rating Widget

This example demonstrates a product rating component with customized accent colors for different rating levels.

This is a live editor. Play around with it!
export default function ProductRatingWidget() {
  const products = [
    {
      id: 1,
      name: "Wireless Headphones",
      rating: 4.8,
      image: "https://images.unsplash.com/photo-1505740420928-5e560c06d30e",
      alt: "Premium wireless headphones in black"
    },
    {
      id: 2,
      name: "Smart Watch",
      rating: 4.2,
      image: "https://images.unsplash.com/photo-1523275335684-37898b6baf30",
      alt: "Modern smartwatch with fitness features"
    },
    {
      id: 3,
      name: "Laptop Stand",
      rating: 3.9,
      image: "https://images.unsplash.com/photo-1527864550417-7fd91fc51a46",
      alt: "Adjustable aluminum laptop stand"
    },
    {
      id: 4,
      name: "Mechanical Keyboard",
      rating: 4.6,
      image: "https://images.unsplash.com/photo-1511467687858-23d96c32e4ae",
      alt: "RGB mechanical gaming keyboard"
    },
    {
      id: 5,
      name: "Wireless Mouse",
      rating: 4.1,
      image: "https://images.unsplash.com/photo-1527864550417-7fd91fc51a46",
      alt: "Ergonomic wireless mouse"
    },
    {
      id: 6,
      name: "USB-C Hub",
      rating: 4.4,
      image: "https://images.unsplash.com/photo-1588872657578-7efd1f1555ed",
      alt: "Multi-port USB-C hub"
    }
  ];

  return (
    <div className="grid gap-6 p-8">
      {products.map((product) => (
        <div key={product.id} className="border rounded-lg p-4">
          <img 
            src={product.image} 
            alt={product.alt} 
            className="w-full h-48 object-cover rounded-md"
          />
          <h3 className="text-lg font-semibold mt-2">{product.name}</h3>
          <input
            type="range"
            value={product.rating * 20}
            className={`w-full accent-${
              product.rating >= 4.5 ? 'green-500' :
              product.rating >= 4.0 ? 'blue-500' :
              'yellow-500'
            }`}
            readOnly
          />
          <span className="text-sm text-gray-600">{product.rating}/5.0</span>
        </div>
      ))}
    </div>
  );
}

Task Priority Selector

A task management interface with accent colors indicating priority levels.

This is a live editor. Play around with it!
export default function TaskPrioritySelector() {
  const tasks = [
    {
      id: 1,
      title: "Update Website Content",
      priority: "high",
      deadline: "2024-02-01",
      assignee: "Sarah Chen"
    },
    {
      id: 2,
      title: "Fix Mobile Navigation",
      priority: "medium",
      deadline: "2024-02-03",
      assignee: "John Smith"
    },
    {
      id: 3,
      title: "Review Pull Requests",
      priority: "low",
      deadline: "2024-02-05",
      assignee: "Mike Johnson"
    },
    {
      id: 4,
      title: "Optimize Database Queries",
      priority: "high",
      deadline: "2024-02-02",
      assignee: "Lisa Wong"
    },
    {
      id: 5,
      title: "Update Documentation",
      priority: "medium",
      deadline: "2024-02-04",
      assignee: "David Brown"
    },
    {
      id: 6,
      title: "Setup Analytics",
      priority: "low",
      deadline: "2024-02-06",
      assignee: "Emma Davis"
    }
  ];

  return (
    <div className="p-6 max-w-4xl mx-auto">
      {tasks.map((task) => (
        <div key={task.id} className="mb-4 border rounded-lg p-4 flex items-center">
          <input
            type="radio"
            name={`task-${task.id}`}
            className={`mr-4 h-4 w-4 accent-${
              task.priority === 'high' ? 'red-500' :
              task.priority === 'medium' ? 'orange-500' :
              'blue-500'
            }`}
          />
          <div className="flex-1">
            <h3 className="font-semibold">{task.title}</h3>
            <p className="text-sm text-gray-600">
              Assigned to: {task.assignee} | Due: {task.deadline}
            </p>
          </div>
        </div>
      ))}
    </div>
  );
}

Progress Indicator

An advanced progress tracking system with accent colors for different completion stages.

This is a live editor. Play around with it!
export default function ProgressIndicator() {
  const courses = [
    {
      id: 1,
      title: "Introduction to React",
      progress: 90,
      totalModules: 10,
      completedModules: 9
    },
    {
      id: 2,
      title: "Advanced JavaScript Concepts",
      progress: 45,
      totalModules: 12,
      completedModules: 5
    },
    {
      id: 3,
      title: "CSS Mastery",
      progress: 75,
      totalModules: 8,
      completedModules: 6
    },
    {
      id: 4,
      title: "Web Performance Optimization",
      progress: 30,
      totalModules: 6,
      completedModules: 2
    },
    {
      id: 5,
      title: "TypeScript Fundamentals",
      progress: 60,
      totalModules: 10,
      completedModules: 6
    },
    {
      id: 6,
      title: "Node.js Essentials",
      progress: 15,
      totalModules: 8,
      completedModules: 1
    }
  ];

  return (
    <div className="p-8 bg-gray-50">
      {courses.map((course) => (
        <div key={course.id} className="mb-6 bg-white p-4 rounded-lg shadow">
          <h3 className="text-lg font-semibold">{course.title}</h3>
          <div className="mt-2">
            <input
              type="range"
              value={course.progress}
              className={`w-full accent-${
                course.progress >= 75 ? 'green-500' :
                course.progress >= 40 ? 'blue-500' :
                'purple-500'
              }`}
              readOnly
            />
            <div className="flex justify-between text-sm text-gray-600">
              <span>{course.completedModules}/{course.totalModules} modules</span>
              <span>{course.progress}% complete</span>
            </div>
          </div>
        </div>
      ))}
    </div>
  );
}

Subscription Plan Selector

A subscription plan selector with accent colors for different tiers.

This is a live editor. Play around with it!
export default function SubscriptionPlanSelector() {
  const plans = [
    {
      id: 1,
      name: "Basic",
      price: 9.99,
      tier: "basic",
      features: ["5GB Storage", "2 Users", "Basic Support"]
    },
    {
      id: 2,
      name: "Pro",
      price: 19.99,
      tier: "pro",
      features: ["25GB Storage", "5 Users", "Priority Support"]
    },
    {
      id: 3,
      name: "Enterprise",
      price: 49.99,
      tier: "enterprise",
      features: ["Unlimited Storage", "Unlimited Users", "24/7 Support"]
    },
  ];

  return (
    <div className="grid gap-6 p-8">
      {plans.map((plan) => (
        <div key={plan.id} className="border rounded-lg p-6">
          <h3 className="text-xl font-bold">{plan.name}</h3>
          <p className="text-2xl font-semibold mt-2">${plan.price}/mo</p>
          <ul className="mt-4 space-y-2">
            {plan.features.map((feature, index) => (
              <li key={index} className="flex items-center">
                <input
                  type="checkbox"
                  checked
                  className={`mr-2 accent-${
                    plan.tier === 'enterprise' ? 'purple-500' :
                    plan.tier === 'pro' ? 'blue-500' :
                    'green-500'
                  }`}
                  readOnly
                />
                {feature}
              </li>
            ))}
          </ul>
        </div>
      ))}
    </div>
  );
}

File Upload Status

A file upload interface with accent colors indicating upload status.

This is a live editor. Play around with it!
export default function FileUploadStatus() {
  const files = [
    {
      id: 1,
      name: "project-presentation.pptx",
      size: "2.5MB",
      progress: 100,
      status: "completed"
    },
    {
      id: 2,
      name: "annual-report.pdf",
      size: "4.8MB",
      progress: 65,
      status: "uploading"
    },
    {
      id: 3,
      name: "product-images.zip",
      size: "12.3MB",
      progress: 0,
      status: "queued"
    },
    {
      id: 4,
      name: "database-backup.sql",
      size: "8.1MB",
      progress: 100,
      status: "completed"
    },
    {
      id: 5,
      name: "client-contract.docx",
      size: "1.2MB",
      progress: 30,
      status: "uploading"
    },
    {
      id: 6,
      name: "marketing-assets.zip",
      size: "15.7MB",
      progress: 0,
      status: "queued"
    }
  ];

  return (
    <div className="p-6 max-w-3xl mx-auto">
      {files.map((file) => (
        <div key={file.id} className="mb-4 border rounded-lg p-4">
          <div className="flex justify-between items-center mb-2">
            <span className="font-medium">{file.name}</span>
            <span className="text-sm text-gray-500">{file.size}</span>
          </div>
          <input
            type="range"
            value={file.progress}
            className={`w-full accent-${
              file.status === 'completed' ? 'green-500' :
              file.status === 'uploading' ? 'blue-500' :
              'gray-500'
            }`}
            readOnly
          />
          <div className="flex justify-between text-sm mt-1">
            <span>{file.progress}%</span>
            <span className="capitalize">{file.status}</span>
          </div>
        </div>
      ))}
    </div>
  );
}

Customization Examples

Custom Product Signup Form with Sunset Accents

A sleek signup form using sunset and coral accent colors for form inputs and checkboxes, creating a warm and inviting user interface.

This is a live editor. Play around with it!
import tailwindConfig from "./tailwind.config.js";
tailwind.config = tailwindConfig;

// ProductSignupForm.jsx
export default function ProductSignupForm() {
  const formFields = [
    {
      id: 'name',
      label: 'Full Name',
      type: 'text',
      placeholder: 'John Doe',
      required: true
    },
    {
      id: 'email',
      label: 'Email',
      type: 'email',
      placeholder: 'john@example.com',
      required: true
    },
    {
      id: 'terms',
      label: 'I agree to terms',
      type: 'checkbox',
      required: true
    },
    {
      id: 'newsletter',
      label: 'Subscribe to newsletter',
      type: 'checkbox',
      required: false
    },
    {
      id: 'updates',
      label: 'Receive product updates',
      type: 'checkbox',
      required: false
    }
  ];

  return (
    <div className="w-[350px] bg-white p-6">
      <form className="space-y-4">
        <h2 className="text-xl font-bold text-gray-900">Sign Up for Beta</h2>
        
        {formFields.map((field) => (
          <div key={field.id} className="space-y-2">
            {field.type === 'checkbox' ? (
              <div className="flex items-center space-x-2">
                <input
                  type="checkbox"
                  id={field.id}
                  required={field.required}
                  className="h-4 w-4 rounded accent-sunset hover:accent-coral"
                />
                <label htmlFor={field.id} className="text-sm text-gray-700">
                  {field.label}
                  {field.required && <span className="text-red-500">*</span>}
                </label>
              </div>
            ) : (
              <>
                <label htmlFor={field.id} className="block text-sm font-medium text-gray-700">
                  {field.label}
                  {field.required && <span className="text-red-500">*</span>}
                </label>
                <input
                  type={field.type}
                  id={field.id}
                  placeholder={field.placeholder}
                  required={field.required}
                  className="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-sunset focus:outline-none focus:ring-1 focus:ring-sunset"
                />
              </>
            )}
          </div>
        ))}
        
        <button
          type="submit"
          className="w-full rounded-md bg-sunset px-4 py-2 text-sm font-semibold text-white hover:bg-coral"
        >
          Sign Up
        </button>
      </form>
    </div>
  );
}

Neon Music Volume Controller

A dark-themed audio mixing interface with neon green accents for sliders and controls, providing a modern music studio feel.

This is a live editor. Play around with it!
import tailwindConfig from "./tailwind.config.js";
tailwind.config = tailwindConfig;

// MusicVolumeControl.jsx
export default function MusicVolumeControl() {
  const audioTracks = [
    {
      id: 1,
      name: "Main Track",
      volume: 75,
      icon: "🎵"
    },
    {
      id: 2,
      name: "Bass",
      volume: 60,
      icon: "🥁"
    },
    {
      id: 3,
      name: "Vocals",
      volume: 85,
      icon: "🎤"
    },
    {
      id: 4,
      name: "Effects",
      volume: 45,
      icon: "✨"
    }
  ];

  return (
    <div className="w-[365px] space-y-6 bg-gray-900 p-6">
      <h2 className="text-xl font-bold text-white">Mix Controller</h2>
      
      <div className="space-y-4">
        {audioTracks.map((track) => (
          <div key={track.id} className="space-y-2">
            <div className="flex items-center justify-between">
              <span className="flex items-center space-x-2">
                <span className="text-xl">{track.icon}</span>
                <span className="text-sm font-medium text-white">{track.name}</span>
              </span>
              <span className="text-sm text-gray-400">{track.volume}%</span>
            </div>
            
            <input
              type="range"
              defaultValue={track.volume}
              className="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-700 accent-neon hover:accent-mint"
            />
          </div>
        ))}
      </div>
      
      <div className="flex justify-between">
        <button className="rounded bg-gray-800 px-4 py-2 text-sm font-medium text-neon hover:bg-gray-700">
          Reset
        </button>
        <button className="rounded bg-neon px-4 py-2 text-sm font-medium text-gray-900 hover:bg-mint">
          Save Mix
        </button>
      </div>
    </div>
  );
}

Order Progress Tracker

A streamlined order tracking interface that combines a vertical timeline with checkpoints and a progress bar, using a custom accent color to highlight the completed steps.

This is a live editor. Play around with it!
import tailwindConfig from "./tailwind.config.js";
tailwind.config = tailwindConfig;

// ProductProgress.jsx
export default function ProductProgress() {
  const steps = [
    { id: 1, name: 'Order Placed', completed: true },
    { id: 2, name: 'Processing', completed: true },
    { id: 3, name: 'Shipping', completed: true },
    { id: 4, name: 'Delivered', completed: false }
  ];

  return (
    <div className="w-[450px] p-6 bg-white rounded-lg shadow-md h-screen">
      <h2 className="text-xl font-semibold mb-6">Order Status</h2>
      
      <div className="space-y-4">
        {steps.map((step, index) => (
          <div key={step.id} className="relative">
            <div className="flex items-center">
              <input 
                type="checkbox"
                checked={step.completed}
                className="accent-checkbox mr-3"
                readOnly
              />
              <span className={`font-medium ${
                step.completed ? 'text-gray-900' : 'text-gray-500'
              }`}>
                {step.name}
              </span>
            </div>
            
            {index < steps.length - 1 && (
              <div 
                className="absolute left-[0.5rem] top-[1.5rem] h-[calc(100%-0.5rem)] w-px bg-gray-200"
              />
            )}
          </div>
        ))}
      </div>
    </div>
  );
}

Best Practices

Maintain Design Consistency

To ensure your project maintains a cohesive look, you should standardize Accent Color usage across all interactive components. Tailwind CSS provides a unified color palette, making it easier to synchronize styles. Assign specific accent color classes like accent-blue-500 or accent-green-400 for related components such as radio buttons or checkboxes throughout your project. Consistent usage reinforces your brand identity and improves the user experience.

For larger projects, extending Tailwind's color themes in the tailwind.config.js file can help establish project-specific consistency. For instance, you might define brand-specific shades for primary and secondary accents and reuse them across your UI.

Balance with Other Layout Properties

Combining accent utilities with layout-specific styling ensures your components are visually appealing while remaining functional. Classes like flex, grid, and space-{size} can structure inputs or buttons with accent colors into well-organized sections. This technique is particularly effective for symmetrical forms or UI components that require distinct groupings.

Consider a login form where you group checkboxes and radio buttons effectively:

This is a live editor. Play around with it!
export default function BalancedLayout() {
  return (
    <div className="p-10 max-w-md mx-auto bg-white shadow-lg rounded-xl">
      <h2 className="text-lg font-semibold text-gray-800">User Preferences</h2>
      <div className="mt-6 space-y-4">
        <div className="flex items-center space-x-4">
          <input type="checkbox" className="accent-indigo-500" />
          <span className="text-gray-700">Enable notifications</span>
        </div>
        <div className="flex items-center space-x-4">
          <input type="radio" name="theme" className="accent-green-500" />
          <span className="text-gray-700">Light Theme</span>
        </div>
        <div className="flex items-center space-x-4">
          <input type="radio" name="theme" className="accent-blue-500" />
          <span className="text-gray-700">Dark Theme</span>
        </div>
      </div>
    </div>
  );
}

Proper alignment using space-x-4 and mt-6 ensures adequate spacing between sections and reduces visual clutter. Balance your layout properties to keep your interfaces clean and user-friendly without compromising accent visibility.

Accessibility Considerations

Enhance Readability and Navigability

Accent Colors play a pivotal role in improving both the readability and navigability of your UI. When applied thoughtfully, they help users distinguish between interactive and non-interactive elements.

Assign colors notable enough to attract attention but harmonious with the overarching theme, ensuring smooth contextual interpretations. Also, keep labels close to their controls to improve usability, especially for screen readers.

Support Accessible Interactive Elements

Interactive components like buttons and form inputs should signal their functionality clearly. Enhance their usability with accent utilities combined with hover, focus, and disabled states to provide visual feedback during interaction.

Here’s an interactive preference form:

This is a live editor. Play around with it!
export default function InteractiveElements() {
  return (
    <div className="p-8 bg-gray-800 text-gray-200 h-screen">
      <h3 className="text-lg font-semibold">Preference Settings</h3>
      <div className="mt-4 space-y-4">
        <div className="flex items-center space-x-4">
          <input 
            type="checkbox" 
            className="accent-teal-500 hover:accent-teal-700 focus:ring-2 focus:ring-teal-300" 
          />
          <span className="text-teal-200">Show notifications</span>
        </div>
        <div className="flex items-center space-x-4">
          <input 
            type="radio" 
            name="display-mode" 
            className="accent-purple-500 hover:accent-purple-600 focus:ring-2 focus:ring-purple-300" 
          />
          <span className="text-purple-200">Use compact layout</span>
        </div>
      </div>
    </div>
  );
}

Debugging Common Issues

Handle Nested Element Challenges

Deeply nested structures can interfere with the expected coloring behavior of children components. Tailwind’s peer class can simplify child-parent interactions without overriding styles globally.

Here’s a sample checkbox-and-label setup with nested dependencies handled:

This is a live editor. Play around with it!
export default function NestedControls() {
  return (
    <div className="p-6">
      <label className="flex items-center">
        <input 
          type="checkbox" 
          className="peer accent-red-500 h-5 w-5" 
        />
        <span className="ml-2 peer-checked:text-red-500">Activate mode</span>
      </label>
    </div>
  );
}

The peer class allows child elements (like <span>) to inherit visual feedback based on the ancestor’s state, avoiding styling conflicts.