Skip to content

Type to search the docs, API, and blog.

↑↓ navigate↵ openesc close
  • Zazz 0.14 alpha

    API

    Effects

    Shadows, opacity, filters, blending, and masks.

    --elevation takes a height and draws it as a four-layer box-shadow: --elevation: 4 uses the layers of --shadow-md, and the shadow grows and darkens as the number rises. Every layer blurs by at most its distance and pulls in by a negative spread, so with the light overhead nothing shows above the element or past its sides. A negative height draws like its absolute value, and a word draws nothing. It takes states and breakpoints (--elevation: 1.5; --elevation--hover: 4), shares one box-shadow with the --ring* utilities (rings first) and --shadow (an explicit --shadow wins), and replaces a primitive's resting shadow where you set it.

    --shadow is the box-shadow form: a token (--shadow: var(--shadow-md)) or any box-shadow, and it never removes a primitive's focus ring. --shadow-tint colors every shadow in a subtree and --shadow-angle turns the light: 0deg is down, 90deg left, 180deg up, at any breakpoint (--shadow-angle: 180deg on a bottom sheet, --shadow-angle--md: 0deg once it becomes a card). --default-shadow-angle on :root sets it for the page, and --default-shadow-intensity, --default-shadow-blur, and --default-shadow-distance scale every shadow's alpha, blur, and offset. --opacity fades the whole element; for a translucent fill, see --bg-alpha.

    --filter takes any CSS filter list (--filter: grayscale(1); --filter--hover: none colors a logo on hover). --backdrop-filter filters what shows through the element, so it needs a translucent --bg to read as frosted glass (--bg: var(--color-background); --bg-alpha: 0.6; --backdrop-filter: blur(12px)). --mix-blend sets mix-blend-mode (multiply, screen, overlay, …) to blend the element with what is behind it. All three take state tiers, work tier-only, and exist on ::before and ::after as --before-filter, --after-mix-blend, and so on. A --filter or --backdrop-filter other than none makes the element the containing block for its position: fixed descendants.

    --mask-linear and --mask-stops fade an element out with a linear-gradient mask-image, the same way --bg-linear and --bg-stops paint a background: --mask-linear: to bottom; --mask-stops: black 70%, transparent fades the last 30% to nothing. Opaque stops show the element and transparent stops hide it, so any color works and only its alpha counts. The mask doesn't repeat and replaces any other mask on the element. It needs both utilities, and neither one takes tiers or states.

    Reference

    Effects utilities
    UtilityWritesValueTiersNotes
    --shadowbox-shadowa token (var(--shadow-md)) or any box-shadowstatesworks tier-only
    --elevationbox-shadow (four layers, after the rings; an explicit --shadow wins)a height: a number (0 is flat; 4 uses the layers of --shadow-md)breakpoints, statesworks tier-only
    --shadow-tintthe color of the --shadow-* tokens and --elevation on this subtreeany CSS value—
    --shadow-anglethe light direction of the --shadow-* tokens and --elevation on this subtreeangle the light casts at: 0deg down, 90deg left, 180deg up (default --default-shadow-angle)breakpointsworks tier-only
    --opacityopacityany CSS valuestatesworks tier-only; --before-opacity / --after-opacity
    --filterfilterany CSS valuestatesworks tier-only; --before-filter / --after-filter
    --backdrop-filterbackdrop-filterany CSS valuestatesworks tier-only; --before-backdrop-filter / --after-backdrop-filter
    --mix-blendmix-blend-modekeywordstatesworks tier-only; --before-mix-blend / --after-mix-blend
    --mask-linearmask-image (linear-gradient)gradient prelude: direction—
    --mask-stopsthe mask's stopscomma-separated stops; opaque shows, transparent hides—

    API