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 relative items-center">
<select class="appearance-none row-start-1 col-start-1 ...">
<option>Yes</option>
<option>No</option>
<option>Maybe</option>
</select>
<svg class="row-start-1 col-start-1">
<!-- ... -->
</svg>
</div>
Use appearance-auto
to revert to the default browser specific styling on an element. This is mostly 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
<div class="grid items-center justify-center">
<input type='checkbox' class="appearance-none forced-colors:appearance-auto ..." />
<svg class="forced-colors:hidden invisible peer-checked:visible ..." >
<!-- ... -->
</svg>
</div>
<div class="grid items-center justify-center">
<input type='checkbox' class="appearance-none ..." />
<svg class="invisible peer-checked:visible ...">
<!-- ... -->
</svg>
</div>
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.