Dev Helpers

Tailwind CSS / Media and shapes

Clip a swatch to a diamond

Dev Helpers · March 18, 2026

A polygon expressed as an arbitrary utility is a compact way to clip a decorative token. The outer grid still sizes the original rectangular box.

Worked example

<div
  class="demo size-24 [clip-path:polygon(50%_0,100%_50%,50%_100%,0_50%)]"
  aria-hidden="true"
></div>

Implementation notes

Some arbitrary utilities might disappear from a generated stylesheet if assembled from partial strings. Keep complete class names visible to the build pipeline.

Try it yourself

Put a diamond beside a square in equal columns.

Open the Tailwind CSS example →

Editorial date March 18, 2026 · Published December 6, 2026

Related articles

Selection background swatch

The selection variant lets a component specify its own selected-text colours. Readability depends on the selected foreground as well as the highlight.

Skew a label

A skew utility changes the painted shape without allocating extra room for the slanted edge. A separate inner wrapper can keep lettering upright.

Horizontal flex row

Flex utilities define the row but children can still resist shrinking. Inspect long labels before adding more breakpoints.