Buttons
button und .btn erhalten den Primary-Hintergrund, automatischen Kontrast-Text und Hover-/Active-States, in oklch aus derselben Farbe abgeleitet.
Normale <button>-Elemente und .btn werden ohne jede Klasse gestylt: Primary-Hintergrund, automatischer Kontrast-Text und Hover-/Active-States, in oklch aus derselben Basisfarbe abgeleitet. Links bekommen ebenfalls die Primary-Farbe, und Input-Buttons (submit, reset, button) sind ebenfalls abgedeckt.
Hover (×0.8) und Active (×0.7) leiten sich in oklch von der Basisfarbe ab, und contrast-color() wählt kostenlos lesbaren Text – eine Farbe steuert den ganzen Button. Fokusringe erscheinen nur für Tastaturnutzer (:focus-visible).
Zur Laufzeit: --forma-button-font-size, -line-height, -font-weight, -padding und -gap pro Element, plus --forma-button-color, um einen einzelnen Button umzufärben (genau das machen .btn-secondary und .btn-contrast intern). Zur Build-Zeit: $font-family-buttons, $border-radius-button und die $color-*-Palette.
Varianten
Der schlichte <button> ist die primäre Aktion. .btn-secondary und .btn-contrast färben über --forma-button-color um, und die .btn-outline*-Varianten behalten dieselben Farbtöne als Rahmen über transparentem Hintergrund.
<div class="flex-row" style="align-items: center">
<button>Primär</button>
<button class="btn-secondary">Sekundär</button>
<button class="btn-contrast">Kontrast</button>
<button class="btn-outline">Outline</button>
<button class="btn-outline-secondary">Outline sekundär</button>
<button class="btn-outline-contrast">Outline kontrast</button>
</div>Universelle Größen
Die universellen Klassen .sm, .lg und .xl skalieren Buttons kaskadierend: sie multiplizieren --forma-font-size-base, sodass Padding und Icons mit dem Text mitwachsen.
<div class="flex-row" style="align-items: center">
<button class="sm">Klein</button>
<button>Standard</button>
<button class="lg">Groß</button>
<button class="xl">Extragroß</button>
</div>Buttons mit Icons
Buttons sind Flex-Container, sodass Inline-SVG-Icons sofort mit dem Text ausgerichtet sind; .btn-round wechselt für Icon-only-Buttons auf 50% Radius mit 0.5em Padding.
<div class="flex-row" style="align-items: center">
<button><svg class="bi" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M8 2v7M5 6.5 8 9.5 11 6.5M3 13.5h10"/></svg>Herunterladen</button>
<button class="btn-outline"><svg class="bi" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M13.5 8A5.5 5.5 0 1 1 11.9 4.1M13.5 2.5V5H11"/></svg>Aktualisieren</button>
<button class="btn-round" aria-label="Einstellungen"><svg class="bi" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="8" cy="8" r="2.5"/><path d="M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2M3.4 3.4l1.4 1.4M11.2 11.2l1.4 1.4M12.6 3.4l-1.4 1.4M4.8 11.2l-1.4 1.4"/></svg></button>
<button class="btn-round btn-secondary sm" aria-label="Hinzufügen"><svg class="bi" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M8 3v10M3 8h10"/></svg></button>
</div>Button-Gruppen
.btn-group ordnet verwandte Aktionen als ein verbundenes Steuerelement an; .btn-group-vertical stapelt sie. Jede Button-Variante funktioniert darin.
<div class="flex-row">
<div class="btn-group">
<button>Tag</button>
<button>Woche</button>
<button>Monat</button>
</div>
<div class="btn-group-vertical">
<button class="btn-outline">Umbenennen</button>
<button class="btn-outline">Duplizieren</button>
<button class="btn-outline">Löschen</button>
</div>
</div>Button-Gruppe mit Dropdown
Ein <details class="dropdown"> in der Gruppe ergänzt ein Menü, ohne die Button-Sprache zu verlassen; Untermenüs verschachteln sich mit .dropright.
Mehr
<div class="flex-row">
<div class="btn-group">
<button>Speichern</button>
<details class="dropdown">
<summary class="btn">
Mehr
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">Umbenennen</a></li>
<li>
<details class="dropdown dropright">
<summary>
Exportieren
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"/></svg>
</summary>
<ul>
<li><a href="#">HTML</a></li>
<li><a href="#">Markdown</a></li>
<li><hr></li>
<li><a href="#">PDF</a></li>
</ul>
</details>
</li>
<li><a href="#">Löschen</a></li>
</ul>
</details>
</div>
</div>Formular-Inputs
Input-Buttons (submit, reset, button) werden wie jeder andere Button gestylt – innerhalb eines Formulars ist keine Klasse nötig.
<form class="flex-row">
<input type="text" name="task" placeholder="Aufgabentitel">
<input type="submit" value="Aufgabe hinzufügen">
<input type="reset" value="Leeren">
</form>