Masks

DMask clips any content to a daisyUI mask shape. Masks are CSS mask-images, so the content behind shows through the cut — works with images, gradients and text.

Shapes
Circle
Squircle
Heart
Hexagon
Hexagon2
Pentagon
Decagon
Diamond
Star
Star2
Triangle
Triangle2
@foreach (var shape in _shapes)
{
    <DMask Shape="@shape" Class="h-16 w-16 bg-[var(--color-primary)]" />
}
 
@code {
    private static readonly DaisyMaskShape[] _shapes =
    [
        DaisyMaskShape.Circle,
        DaisyMaskShape.Squircle,
        DaisyMaskShape.Heart,
        DaisyMaskShape.Hexagon,
        DaisyMaskShape.Hexagon2,
        DaisyMaskShape.Pentagon,
        DaisyMaskShape.Decagon,
        DaisyMaskShape.Diamond,
        DaisyMaskShape.Star,
        DaisyMaskShape.Star2,
        DaisyMaskShape.Triangle,
        DaisyMaskShape.Triangle2,
    ];
}
Masked images
Masked portrait
Masked landscape
<DMask Shape="DaisyMaskShape.Squircle" Class="h-32 w-32">
    <img src="https://picsum.photos/id/1027/256/256" alt="Masked portrait" class="h-full w-full object-cover" />
</DMask>
<DMask Shape="DaisyMaskShape.Heart" Class="h-32 w-32 bg-[var(--color-error)]" />
<DMask Shape="DaisyMaskShape.Star" Class="h-32 w-32 bg-[var(--color-warning)]" />
<DMask Shape="DaisyMaskShape.Hexagon" Class="h-32 w-32">
    <img src="https://picsum.photos/id/1084/256/256" alt="Masked landscape" class="h-full w-full object-cover" />
</DMask>
Masked text & stacks
DAISY
<DMask Shape="DaisyMaskShape.Circle" Class="h-24 w-24 bg-gradient-to-br from-[var(--color-primary)] to-[var(--color-secondary)]" />
<DMask Shape="DaisyMaskShape.Diamond" Class="h-24 w-24 bg-[var(--color-accent)] p-4">
    <span class="text-accent-content font-black text-lg leading-tight">DAISY</span>
</DMask>
<DMask Shape="@(_shapes[3])" Class="h-24 w-24 bg-[var(--color-info)]" />
Tips
  • The avatar component already uses masks internally — DMask exposes them for arbitrary content.
  • Size the mask itself (h-16 w-16); children just need to fill it.

API

DMask

Parameters

Name Type Default Binding Description
Shape DaisyMaskShape Default — The mask shape.
DefaultCircleDecagonDiamondHeartHexagonHexagon2PentagonSquircleStarStar2TriangleTriangle2Triangle3Triangle4
ChildContent RenderFragment — — Content to mask (typically an image or a colored block).
Class string — — Additional CSS classes appended to the component's computed daisyUI classes.
Style string — — Inline styles applied to the root element.
Connection lost — reconnecting…
Connection failed.
The server has stopped.