Interactivity
Utilities for suppressing native form control styling.
Use appearance-none
to reset any browser specific styling on an element. This utility is often used when creating custom form components.
<select>
<option>Yes</option>
<option>No</option>
<option>Maybe</option>
</select>
<div class="grid">
<select class="appearance-none row-start-1 col-start-1 bg-slate-50 dark:bg-slate-800 ...">
<option>Yes</option>
<option>No</option>
<option>Maybe</option>
</select>
<svg class="pointer-events-none row-start-1 col-start-1 ...">
<!-- ... -->
</svg>
</div>
Use appearance-auto
to restore the default browser specific styling on an element. This is useful for reverting to the standard browser controls in certain accessibility modes.
Try emulating `forced-colors: active` in your developer tools to see the difference
<label>
<div>
<input type="checkbox" class="appearance-none forced-colors:appearance-auto ..." />
<svg class="invisible peer-checked:visible forced-colors:hidden ..." >
<!-- ... -->
</svg>
</div>
Falls back to default appearance
</label>
<label>
<div>
<input type="checkbox" class="appearance-none ..." />
<svg class="invisible peer-checked:visible ...">
<!-- ... -->
</svg>
</div>
Keeps custom appearance
</label>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:appearance-none
to only apply the appearance-none
utility on hover.
<div class="appearance-auto hover:appearance-none">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:appearance-none
to apply the appearance-none
utility at only medium screen sizes and above.
<div class="appearance-auto md:appearance-none">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.