← Back to Forms

Forms pattern

Newsletter signup form

A focused email signup with a persistent label, useful expectations, and a flexible action row.

Live example

See the pattern in isolation

The preview uses the same locked-down composition policy as the Agate IDE.

PreviewSandboxed

Canonical source

Copy it, change it, keep it plain

These exact files power the preview and the IDE handoff.

Source

HTML

<section class="signup" aria-labelledby="signup-title">
  <div class="signup__intro">
    <p class="signup__eyebrow">A useful note, occasionally</p>
    <h1 id="signup-title">Make the web a little clearer.</h1>
    <p id="signup-description">One practical HTML or CSS lesson every other Thursday. No tracking pixels and no daily promotions.</p>
  </div>

  <form class="signup__form" method="post" aria-describedby="signup-description signup-privacy">
    <label for="signup-email">Email address</label>
    <div class="signup__controls">
      <input id="signup-email" name="email" type="email" autocomplete="email" inputmode="email" required>
      <button type="submit">Join the list</button>
    </div>
    <p id="signup-privacy">You can unsubscribe using the link in every message.</p>
  </form>
</section>
Source

CSS

* {
  box-sizing: border-box;
}

body {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: clamp(1.5rem, 7vw, 6rem);
  place-items: center;
  background: #b0436a;
  color: #2b151d;
  font-family: system-ui, sans-serif;
}

.signup {
  display: grid;
  width: min(100%, 64rem);
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.85fr);
  gap: clamp(2rem, 6vw, 5rem);
  padding: clamp(1.5rem, 6vw, 4rem);
  border: 4px solid #2b151d;
  background: #f7efe6;
}

.signup__eyebrow {
  margin: 0 0 0.75rem;
  color: #8e2f50;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.signup h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1;
}

#signup-description {
  max-width: 50ch;
  margin: 1.25rem 0 0;
  color: #5c3b45;
  line-height: 1.6;
}

.signup__form {
  align-self: end;
}

.signup__form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 850;
}

.signup__controls {
  display: flex;
}

.signup__controls input {
  width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  padding: 0.75rem;
  border: 2px solid #2b151d;
  background: #ffffff;
  color: #2b151d;
  font: inherit;
}

.signup__controls button {
  min-height: 3.25rem;
  padding: 0.75rem 1.1rem;
  border: 2px solid #2b151d;
  border-inline-start: 0;
  background: #b0436a;
  color: #ffffff;
  font: inherit;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.signup__controls button:hover {
  background: #8e2f50;
}

.signup__controls input:focus-visible,
.signup__controls button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 4px solid #176b87;
  outline-offset: 3px;
}

#signup-privacy {
  margin: 0.75rem 0 0;
  color: #6e4b55;
  font-size: 0.85rem;
  line-height: 1.45;
}

@media (max-width: 46rem) {
  .signup {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 30rem) {
  .signup__controls {
    gap: 0.65rem;
    flex-direction: column;
  }

  .signup__controls button {
    border-inline-start: 2px solid #2b151d;
  }
}

How it works

A small pattern with visible decisions

The email field has a persistent visible label, the correct input type, and autocomplete hints. The form’s description explains both the content and frequency, while a second note sets a privacy expectation.

The field and action share one row when space allows and stack into full-width controls on small screens. The button has submit semantics; connect the form to your own processing endpoint before publishing it.

Make it yours

Open both files in the workspace.

Agate will protect different saved work before loading this example.