Home/Utilities/Opacity

Opacity

Control element transparency with atomic opacity utilities. Use them for disabled states, overlays, hover effects, and visual hierarchy.

Usage

Apply opacity with .opacity-{value}.

Preview

100
75
50
25
0
<div class="opacity-100">Fully visible</div>
<div class="opacity-50">Half visible</div>
<div class="opacity-0">Transparent</div>

Classes

Class Property
.opacity-0opacity: 0;
.opacity-25opacity: .25;
.opacity-50opacity: .5;
.opacity-75opacity: .75;
.opacity-100opacity: 1;

State usage

Opacity utilities are useful for disabled-looking controls without changing the element structure.

<button class="bg-primary text-white px-4 py-2 opacity-50">
  Disabled state
</button>
Note: opacity-0 makes an element transparent, but it still occupies space. Use visibility or display utilities if you need to hide layout space.

Muted and disabled states

Three helpers dim an element to opacity: .5: the .muted class for text or muted controls, the .disabled class for non-interactive elements, and the native :disabled pseudo-class for form controls.

This text is muted
<!-- Muted -->
<span class="muted">Secondary text</span>

<!-- Class-based disabled state -->
<button class="disabled">Disabled button</button>

<!-- Native disabled attribute -->
<button disabled>Disabled button</button>