← Back to Buttons

Buttons pattern

Primary and secondary actions

A wrapping pair of actions with a clear visual order and equal touch targets.

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="decision" id="guided" aria-labelledby="decision-title">
  <p class="decision__label">One small decision</p>
  <h1 id="decision-title">Choose where to begin.</h1>
  <p>Start with the guided example, or open a blank page and make your own structure.</p>
  <div class="action-group" id="blank">
    <a class="action action--primary" href="#guided">Use the example</a>
    <a class="action action--secondary" href="#blank">Start from blank</a>
  </div>
</section>
Source

CSS

* {
  box-sizing: border-box;
}

body {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: 2rem;
  place-items: center;
  background: #d76572;
  color: #2b151d;
  font-family: system-ui, sans-serif;
}

.decision {
  width: min(100%, 34rem);
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 4px solid #2b151d;
  background: #f7efe6;
}

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

.decision h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1;
}

.decision > p:not(.decision__label) {
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.action {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border: 2px solid #2b151d;
  color: #2b151d;
  font-weight: 800;
  text-decoration: none;
}

.action--primary {
  background: #b0436a;
  color: #f7efe6;
}

.action--secondary {
  background: #efc8c7;
}

.action:hover {
  background: #d94f9d;
  color: #2b151d;
}

.action:focus-visible {
  outline: 4px solid #2b151d;
  outline-offset: 3px;
}

@media (max-width: 28rem) {
  .action-group {
    display: grid;
  }

  .action {
    width: 100%;
  }
}

How it works

A small pattern with visible decisions

Place the most important action first in the source and give it the strongest fill. The secondary link keeps the same height and border so the pair feels related.

Flex wrapping lets the controls move onto separate lines without a breakpoint, while the narrow-width rule makes both actions easy to tap.

Make it yours

Open both files in the workspace.

Agate will protect different saved work before loading this example.