Forms & inputs / Checkboxes & radios

Square Consent Checkbox

Empty square outlined in light grey beside lowercase consent sentence with underlined privacy link and asterisk.

Rebuilt from teenage.engineering/newsletter in the Embossed Lab Monochrome style.

npx shadcn@latest add https://justyoink.it/r/embossed-lab-monochrome/blocks/square-consent-checkbox.json

Looks exactly like teenage.engineering: brings its fonts and colours, namespaced so your own theme stays untouched.

Usage

Props: beforeLink, linkText, linkHref, required, defaultChecked, onChange(checked). The checkbox is a native input styled as a light grey square that shows a tick when checked; the link is always underlined.

components/square-consent-checkbox.tsx
import { useState, useId } from "react";

export default function SquareConsentCheckbox({
  beforeLink = "yes, please send me occasional updates and agree to the",
  linkText = "terms of contact",
  linkHref = "#",
  required = true,
  defaultChecked = false,
  onChange,
}: {
  beforeLink?: string;
  linkText?: string;
  linkHref?: string;
  required?: boolean;
  defaultChecked?: boolean;
  onChange?: (checked: boolean) => void;
}) {
  const [checked, setChecked] = useState(defaultChecked);
  const id = useId();
  return (
    <div className="flex items-center gap-4 bg-canvas-0 font-sans">
      <span className="relative inline-flex h-[30px] w-[30px] shrink-0">
        <input
          id={id}
          type="checkbox"
          checked={checked}
          required={required}
          onChange={(e) => {
            setChecked(e.target.checked);
            onChange?.(e.target.checked);
          }}
          className="peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none border border-surface-muted bg-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ink"
        />
        <svg
          viewBox="0 0 24 24"
          aria-hidden="true"
          className="pointer-events-none absolute inset-1 z-20 h-[22px] w-[22px] scale-75 text-ink opacity-0 transition-all duration-tile-hover ease-tile-hover peer-checked:scale-100 peer-checked:opacity-100"
        >
          <path d="M4 12.5l5 5L20 6.5" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="square" />
        </svg>
      </span>
      <label htmlFor={id} className="cursor-pointer text-body-lg font-light text-ink">
        {beforeLink}{" "}
        <a
          href={linkHref}
          className="underline underline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-ink"
        >
          {linkText}
        </a>
        {required && <span aria-hidden="true"> *</span>}
      </label>
    </div>
  );
}

Quality checks

Automated, in a real browser · today
—

More from Embossed Lab Monochrome

The whole style →

Pictogram Mega Nav Bar

Headers & nav bars

Centered Link Footer

Footers

Embossed Advent Tile Grid

Feature sections

Embossed Relief Tile

Cards

Centered Uppercase Intro Panel

Heroes

Quiet Countdown Readout

Stats & metrics