Skip to content
Latestv1.0.63

Price ​

Core component for e-commerce to display product prices in a standardized way. Supports amount splitting, range display, thousand separators, and animated number updates.

Basic Usage ​

Standard price display with two decimal places and the default currency symbol. You can also move the symbol behind the number or enable the approximate mark.

Basic Usage

Price Range ​

Use max-value to render a price range, which is common in SKU listings and product collections.

Price Range

E-commerce Expansion ​

Combine tags, original-price display, unit labels, and gradient text to match richer retail card layouts.

E-commerce Scene

Sizes ​

Built-in presets are available for small, default, and large. You can still customize the final size with CSS or theme variables.

Size Comparison

More Features ​

Standard struck-through prices and thousand separators are built in, so common retail price patterns can be composed without extra markup.

Features

Use in Nuxt ​

YhPrice can be used directly in Nuxt 3/4 after registering @yh-ui/nuxt. If you enable animated, update the bound value on the client when you want the animation to start after hydration.

Nuxt Integration

API ​

Props ​

PropertyDescriptionTypeDefault
valueCurrent price valuenumber | string0
max-valueMaximum price used for range displaynumber | stringundefined
symbolCurrency symbolstring'¥'
symbol-positionCurrency symbol position'before' | 'after''before'
precisionDecimal precisionnumber2
line-throughWhether to render the main price as struck throughbooleanfalse
sizeBuilt-in size preset'small' | 'default' | 'large' | string'default'
splitWhether to split integer and decimal font sizesbooleantrue
decimal-scaleDecimal font-size rationumber0.8
thousandthWhether to insert thousand separatorsbooleantrue
boldWhether to apply bold weightbooleanfalse
prefixPrefix textstring''
suffixSuffix textstring''
unitUnit label, such as /kgstring''
delete-valueSecondary original price valuenumber | stringundefined
delete-labelLabel shown before the deleted pricestring''
tagTag text shown before the pricestring''
tag-typeTag visual type'primary' | 'success' | 'warning' | 'danger' | 'info''danger'
approxWhether to prepend an approximate markbooleanfalse
animatedWhether to animate value changesbooleanfalse
gradientGradient text modeboolean | string[]false
theme-overridesComponent-level theme variable overridesRecord<string, string>{}

Events ​

This component does not expose component events.

Slots ​

SlotDescriptionParameters
tagCustom tag content-
prefixCustom prefix content-
symbolCustom currency symbol content-
unitCustom unit content-
suffixCustom suffix content-

Expose ​

This component does not expose public instance methods or properties.

Theme Variables ​

VariableDescriptionDefault
--yh-price-colorPrimary price colorvar(--yh-color-danger)
--yh-price-font-familyPrice font familyvar(--yh-font-family)
--yh-price-integer-sizeBase integer font size1.25em
--yh-price-symbol-sizeBase symbol font size0.75em
--yh-price-decimal-scaleDecimal part scale0.8
--yh-price-tag-bgBadge background colorvar(--yh-color-danger)

Type Exports ​

NameDescription
YhPricePropsComponent props type
YhPriceSlotsComponent slots type
YhPriceInstanceComponent instance type

Released under the MIT License.