Skip to content

SubmitBar

Used at the bottom of e-commerce checkout pages or shopping carts to display total amounts, selected items, and a submit button. It supports safe area insets and "select all" features.

Basic Usage

Displays the total amount and handle the checkout button click. Requires height: 56px or a wrapping container to take up normal document flow space, not needed if sticking to bottom.

Basic Usage

Shopping Cart Mode (with Checkbox)

Includes a "select all" checkbox, suitable for shopping cart pages. By configuring the cent-unit property, you can directly pass backend amounts calculated in "cents".

Shopping Cart

Disabled and Loading State

The component has built-in disabled and loading states, and supports displaying prominent warning/tip banners using the tip property (e.g. out of delivery range).

State Control & Tip Banner

Advanced Slot Customization

You can use the #tip, #left, #button, and #right slots to implement an extremely customized shopping checkout bar layout.

Advanced Slots

Use in Nuxt

This component is fully compatible with Nuxt 3/4 SSR rendering.

Nuxt Usage
ts
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@yh-ui/nuxt'],
  yhUI: {
    // 默认已自动按需引入,无需特殊配置
    // options...
  }
})

API

Props

ParameterDescriptionTypeDefault
priceAmountnumber0
currencyCurrency symbolstring¥
cent-unitWhether price is in cent unitbooleanfalse
decimal-lengthDecimal length to keepnumber2
labelPrefix label for the total textstring'Total:'
button-textSubmit button textstring
button-typeButton type (primary danger etc)SubmitBarButtonType'primary'
show-checkboxWhether to display the select-all checkboxbooleanfalse
checkedCheck state, supports v-model:checkedbooleanfalse
indeterminateIndeterminate half-checked statebooleanfalse
selected-countNumber of items selectednumber0
tipTop tip textstring
disabledWhether the button is disabledbooleanfalse
loadingWhether to show loading statebooleanfalse
safe-area-inset-bottomWhether to enable bottom safe area insetbooleantrue
theme-overridesCustom theme overriding objectRecord<string, string>{}

Events

Event NameDescriptionCallback Parameters
submitTriggered when submit button clicked(e: MouseEvent)
update:checkedTriggered when checkbox state bidirectional changes(val: boolean)
check-changeTriggered when checkbox actively toggled(val: boolean)

Slots

Slot NameDescriptionParameters
defaultDefault slot-
tipCustom top tip banner content-
leftCustom content next to select-all checkbox-
rightCustom content next to submit button-
priceCompletely override the middle price display area-
buttonOverride the submit button style and structure-

Expose

This component does not expose public instance methods or properties.

Theme Variables

Easily customize visually by passing theme-overrides prop.

Variable NameDescriptionDefault Value
--yh-submit-bar-bgComponent background colorvar(--yh-bg-color)
--yh-submit-bar-borderTop border colorvar(--yh-border-color-lighter)
--yh-submit-bar-heightComponent height56px
--yh-submit-bar-price-colorReddish main price colorvar(--yh-color-danger)
--yh-submit-bar-price-sizeNumber size of exact integer portion22px
--yh-submit-bar-label-color"Total:" label colorvar(--yh-text-color-regular)
--yh-submit-bar-btn-radiusButton radiusvar(--yh-radius-large)
--yh-submit-bar-btn-min-widthButton container min width108px
--yh-submit-bar-tip-bgTip banner backgroundvar(--yh-color-warning-light-9)
--yh-submit-bar-tip-colorTip banner text colorvar(--yh-color-warning)
--yh-submit-bar-shadowBottom fixed shadow0 -2px 12px var(--yh-shadow-color)
--yh-submit-bar-z-indexSubmitting z-index fixing layer200

Type Exports

NameDescription
YhSubmitBarPropsComponent props type
YhSubmitBarEmitsComponent emits type
YhSubmitBarSlotsComponent slots type
YhSubmitBarButtonTypeButton type union
YhSubmitBarInstanceComponent instance type

Released under the MIT License.