Documentation
Feedback
Guides
Storefront Development

Storefront Development
Storefront development
Price

Prices are used to display the price of a given product, discount and total values.

Prices are used to display the price of a given product, discount and total values.
Example
Code
62.562.562.562.562.5

Usage

Import the component


_10
import { Price } from "@faststore/ui";

Import styles

To apply styles, include the following in your stylesheet:

_10
@import "@faststore/ui/src/components/atoms/Price/styles.scss";


Examples

Variants

Installment

Example
Code
62.5

Listing

Example
Code
62.5

Savings

Example
Code
62.5

Selling

Example
Code
62.5

Spot

Example
Code
62.5

INTL Formatted to parts

Example
Code
$62.50

INTL Formatted

Example
Code
€62.50

Custom price formatter

Example
Code
62,5 reais

Design tokens

Local tokenDefault value/Global token linked
--fs-price-listing-color
var(--fs-color-text-light)
--fs-price-listing-text-decorationline-through
--fs-price-spot-font-weightvar(--fs-text-weight-bold)
--fs-price-spot-color
var(--fs-color-text)

Data attributes

You can target and override Price styles using the following data attributes:
data-fs-price
data-fs-price-variant="selling| 'listing' | 'spot' | 'savings'| 'installment"

Props

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-price
as"symbol" | "object" | "title" | "slot" | "animate" | "style" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "sub" | "summary" | "sup" | "table" | "template" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | ComponentClass<any, any> | FunctionComponent<any>Set the HTML element tag of this component.
value*numberThe raw price value.
formatterPriceFormatterFormatter function that transforms the raw price value and render the result.(price) => price
variant"selling" | "listing" | "spot" | "savings" | "installment"The current use case variant for prices.selling
SRTextstringText for the screen readers only
Contributors
2
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
2
Photo of the contributor
Photo of the contributor
On this page