Buttons
Layout wrapper for one or more .button
elements. A flex row with consistent gap, optional alignment, and an opt-in
.has-addons mode that collapses the gap and shares borders so
adjacent buttons read as a single segmented control.
Live
Default (left-aligned, wrapping flex row)
<div class="buttons">
<button class="button">Save</button>
<button class="button is-primary">Publish</button>
<button class="button is-text">Cancel</button>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'module-buttons')
); .is-centered
<div class="buttons is-centered">
<button class="button">Cancel</button>
<button class="button is-primary">Confirm</button>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'module-buttons')
); .is-right
<div class="buttons is-right">
<button class="button">Discard</button>
<button class="button is-primary">Save</button>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'module-buttons')
); .has-addons (segmented control)
<div class="buttons has-addons">
<button class="button">Left</button>
<button class="button is-primary is-selected">Middle</button>
<button class="button">Right</button>
</div> @use '@adnap/krysalicss' with (
$feature-list: ('base-reset', 'base-global', 'module-buttons')
); Markup
.buttons is markup-agnostic — pass any mix of .button classes,
native <button> elements, or anchor-as-button. The wrapper only owns
layout (flex + gap + alignment). Button styling, sizing, and state
modifiers live on the child elements; see the
Button reference for the full
modifier matrix.
<div class="buttons">
<button class="button">Save</button>
<button class="button is-primary">Publish</button>
<button class="button is-text">Cancel</button>
</div> Alignment
| Modifier | Effect |
|---|---|
| none | Inline-start (flex default). Children wrap onto a new line at narrow widths. |
.is-centered | justify-content: center. |
.is-right | justify-content: flex-end (inline-end under logical flow). |
Addons mode
.has-addons turns a .buttons row into a segmented control: gap
collapses to zero, the inner buttons share borders along the seam, and
only the first/last children keep rounded corners on their outer
inline edges. Implementation details:
gap: 0andflex-wrap: nowrap— the row reads as one continuous control, even at narrow widths (the consumer is expected to keep the addon group compact).- Every child except the last gets
margin-inline-end: -1pxso adjacent 1px borders overlap instead of double-stacking. :hover,:focus,:focus-visible,:activelift the active button toz-index: 1so its border paints fully over its neighbour, not behind it.- Corner radii use logical properties
(
border-start-start-radius,border-end-end-radius, …) so the first/last visual order stays correct underdir="rtl". The radius itself reads from--kc-btn-border-radius(the Button module's runtime token) — segmented controls inherit the consumer's chosen button shape automatically.
<div class="buttons has-addons">
<button class="button">Left</button>
<button class="button is-primary is-selected">Middle</button>
<button class="button">Right</button>
</div> Pair .has-addons with .is-selected on the active child to mark the
chosen segment — same hook as the Button
selected state.
Variables
| Variable | Default | Notes |
|---|---|---|
$selector | '.buttons' | Root wrapper class. |
$gap | 0.5rem | Flex gap between children. Collapsed to 0 under .has-addons. |
$addons-selector | '.has-addons' | Segmented-control modifier. |
$centered-selector | '.is-centered' | Center the row along the main axis. |
$right-selector | '.is-right' | Anchor the row to flex-end. |
Override example
@use '@adnap/krysalicss/module/buttons' with (
$gap: 0.75rem,
); Tokens consumed
| Token | Used for |
|---|---|
--kc-btn-border-radius | Read by the first/last child under .has-addons so segmented controls inherit the consumer's button radius. |
Per-button colour, size, and state tokens (e.g. --kc-primary-bg,
--kc-btn-padding, --kc-focus-ring) are owned by the
Button module — .buttons is
layout-only.