Skip to content

Semantic Helpers

A helper is a class that sets one Level 2 token on a group of components at once. Put it on any container; every matching component inside inherits the value.

.bp-controls--square {
--btn-border-radius: 0;
--input-border-radius: 0;
--datepicker-border-radius: 0;
--pagination-border-radius: 0;
--checkbox-border-radius: 0;
}

Helpers use the same contract as your own CSS: public tokens named after the CSS property, set on a scoped selector. No extra token level, no new variables. They live in @layer bp-utilities.

Class Sets On
bp-controls--square border-radius: 0 button, input, datepicker, pagination, checkbox
bp-controls--pill border-radius: var(--bp-radius-full) button, input, datepicker, pagination
bp-surfaces--square border-radius: 0 card, modal, popover, dropdown, toast, alert, table, accordion, carousel, file-upload, tooltip
bp-surfaces--flat box-shadow: none card, modal, popover, dropdown, toast

Pill controls and square, flat surfaces in one section

Newsletter

<section class="bp-controls--pill bp-surfaces--square bp-surfaces--flat">
<article class="bp-card">
<h3 class="bp-card__title">Newsletter</h3>
<input class="bp-input" type="email" placeholder="[email protected]" aria-label="Email">
<button class="bp-btn" type="button">Subscribe</button>
</article>
</section>

Helpers set tokens on the container, so anything closer to the component wins:

  1. A token on the component itself (.my-cta { --btn-border-radius: 4px }).
  2. A token or helper on a closer ancestor.
  3. The helper on the outer container.
  4. The component default.

Variants (.bp-btn--danger, .bp-badge--success…) don’t block helpers: DS modifiers never write Level 2 tokens, they only change the default of the Level 3 resolver (rule C9).

Write one the same way in your CSS — a class that sets public tokens:

.acme-compact {
--btn-padding: var(--bp-space-2) var(--bp-space-3);
--input-padding: var(--bp-space-2) var(--bp-space-3);
--card-padding: var(--bp-space-4);
}

Use only tokens listed in each component’s Public API table.