SubmitBar
A bottom action bar for pages or sections: extra area (default slot for agreements, notes, etc.) + total amount + primary action button. The total is rendered by the nested oas-price, and the button covers loading, disabled and danger states.
Basic usage
total is the amount and action-text the button label; clicking dispatches oas-submit with { total, currency }.
Total + primary action + event feedback
Click the action button to see oas-submit feedback.
Extra content
The default slot renders before the total — useful for agreement checkboxes or discount notes; it collapses when empty so the amount is never squeezed.
Agreement checkbox
Loading / disabled / danger
loading disables the button, shows a spinner and sets aria-busy="true"; disabled keeps the visuals but blocks the event; danger switches the primary button to the danger color.
States
Tip line
tip renders a notice line above the main row (shipping fee / invoice notes and similar), and tip-icon takes a registered icon name (unregistered names warn once in dev and skip the icon; the text stays readable):
Shipping-fee tip
Safe area and placeholder
The bar's block-end padding uses max(spacing, env(safe-area-inset-bottom)) (notches and gesture bars are avoided automatically). The bar is position: sticky by default (it already occupies the flow, so no spacer is needed). When the host overrides it to fixed with CSS, the spacer is the host's responsibility — add padding-bottom to the page tail and align it with --oas-submit-bar-height (the bar's min-height token, default --oas-control-height-xl). Note the token is a minimum: in the default theme the bar without a tip renders at ≈57px (vertical padding 16 + main row 40 + top border 1), so a 57px fallback in the recipe is closer to reality; with a tip line, stack its rendered height on top (a single-line tip measures ≈27.5px; wrapped copy is taller — go by the actual render):
Fixed-layout spacer recipe (host padding-bottom)
/* Host-side style example */
.checkout-page oas-submit-bar {
position: fixed;
inset-inline: 0;
bottom: 0;
}
.checkout-page {
/* Tail spacer aligned with the bar's rendered height: the min-height token
(default 48px) is only the floor — the bar actually renders ≈57px
(vertical padding 16 + main row 40 + top border 1);
with a tip line, stack its rendered height (single line ≈27.5px) */
padding-bottom: var(--oas-submit-bar-height, 57px);
}Currency and precision
The total is formatted by the same code path as oas-price: currency switches the currency, locale decides symbol placement and grouping and precision sets the decimal places.
Multi-currency / no decimals
Toggling state
Hosts can toggle loading by writing the attribute; no oas-submit fires while loading.
Toggle loading
Styling notes
::part(bar) is a two-layer column flex — the ::part(tip) line stacks above the ::part(row) main row. Overriding flex-direction on ::part(bar) squeezes the tip and the main row onto one line; if you need a different layout, take ::part(tip) / ::part(row) into account together. For fixed-layout spacing see the "Safe area and placeholder" recipe above (align with --oas-submit-bar-height).
API
oas-submit-bar
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
action-text | Primary button text; when omitted no button renders (amount + extra area only) | — | — |
currency | ISO 4217 currency, default CNY | string | CNY |
danger | Primary button uses the danger color (destructive main actions) | boolean | — |
disabled | Disables the button (honours config-provider injected disabled) | boolean | — |
label | Total label, defaults to the i18n submitBar.total | — | — |
loading | Loading: button disabled + spinner + aria-busy, no events dispatched | boolean | — |
locale | Amount formatting locale; defaults to the document <html lang>, then en | — | — |
precision | Amount decimal places, default 2 | string | 2 |
tip | Tip line text (shipping fee / invoice notices shown above the main row) | — | — |
tip-icon | Tip icon name (resolved through the icon registry, custom registration wins); unregistered names warn once in dev and skip the icon, the text stays readable | — | — |
total | Total amount (numeric string); omitted renders no amount | — | — |
Events
| Event | Description |
|---|---|
oas-submit | Dispatched on primary button click (not loading / disabled) with { total, currency }, detail: { total: this.totalValue(), currency: this.getAttr('currency', 'CNY').trim().toUpperCase() || 'CNY', } satisfies SubmitBarDetail |
Slots
| Name | Description |
|---|---|
| default | Extra content before the total (agreement checkboxes, notes, etc.) |
total | Overrides the default amount rendering |
CSS Variables
| CSS Variable | Default |
|---|---|
--oas-submit-bar-height | var(--oas-control-height-xl, 48px) |