Price Bar
The Price Bar displays price information and related content during product flow.
Playground
React Usage
The React PriceBar
component is composed of a number of sub-components. PriceBar
itself typically has two children:
PriceBarBanner
- wrapper for the banner segmentsPriceBarMain
- wrapper for the price, quantity, and main button
Banner
Inside of the PriceBarBanner
there are 1 or more PriceBarBannerSegment
s.
Inside of each PriceBarBannerSegment
there are sub-components:
PriceBarBannerSegmentImage
- image element withsrc
,alt
, ...PriceBarBannerSegmentText
- element to hold the segment text. Rendered asdiv
by default.
Main
Inside of the PriceBarMain
there are more sub-components:
PriceBarMainInfo
- wrapper for price, VAT information, and a "link"PriceBarPrice
- price with currency, wrapper for info iconPriceBarPriceInfo
PriceBarInfoDetails
- wrapper for VAT info and a button
PriceBarButtons
- wrapper for quantity and main buttonsPriceBarQuantity
- wrapper for the quantity button (if the button opens a "panel" modal dialog)Dropdown
- if the quantity button is a simple dropdown insteadPriceBarMainButton
- main button for forward progression in the flow
Inside of the PriceBarInfoDetails
there are more sub-components:
PriceBarVat
- VAT information (do not use withPriceBarCouponCallout
)PriceBarCouponCallout
- Coupon information (do not use withPriceBarVat
)PriceBarLink
- a button that looks like a link, leading to more information
Inside of the PriceBarQuantity
there are more sub-components:
PriceBarQuantityLabel
- optional label for the buttonPriceBarQuantityAmount
- text for inside the quantity button
vanilla usage
You don't have to use the React API, but all the current instances of Price Bar currently do. The vanilla API is similar to the React API, just using appropriate CSS classes. We recommended using a DOM inspector on the above live example to see those classes.
Variants
Coupon callout
You can use a coupon callout in place of the link. Replace PriceBarLink
with a PriceBarCouponCallout
.
<PriceBar><PriceBarBanner><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#1"src="https://via.placeholder.com/32/588da8/ffffff?text=1"/><PriceBarBannerSegmentText>Banner 1</PriceBarBannerSegmentText></PriceBarBannerSegment><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#2"src="https://via.placeholder.com/32/588da8/ffffff?text=2"/><PriceBarBannerSegmentText>Banner 2</PriceBarBannerSegmentText></PriceBarBannerSegment></PriceBarBanner><PriceBarMain><PriceBarMainInfo><PriceBarPrice>$123.45<PriceBarPriceInfo /></PriceBarPrice><PriceBarInfoDetails><PriceBarCouponCallout>Use coupon 20PERCENTOFF</PriceBarCouponCallout></PriceBarInfoDetails></PriceBarMainInfo><PriceBarButtons><PriceBarQuantity onClick={() => alert('Clicked Quantity button')}><PriceBarQuantityLabel>Qty</PriceBarQuantityLabel><PriceBarQuantityAmount>100</PriceBarQuantityAmount></PriceBarQuantity><PriceBarMainButton onClick={() => alert('Clicked Continue button')}>Continue</PriceBarMainButton></PriceBarButtons></PriceBarMain></PriceBar>
Quantity dropdown
If the quantity button doesn't open a "panel" modal dialog but is instead a simple dropdown, replace PriceBarQuantity
with a Dropdown
.
<PriceBar><PriceBarBanner><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#1"src="https://via.placeholder.com/32/588da8/ffffff?text=1"/><PriceBarBannerSegmentText>Banner 1</PriceBarBannerSegmentText></PriceBarBannerSegment><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#2"src="https://via.placeholder.com/32/588da8/ffffff?text=2"/><PriceBarBannerSegmentText>Banner 2</PriceBarBannerSegmentText></PriceBarBannerSegment></PriceBarBanner><PriceBarMain><PriceBarMainInfo><PriceBarPrice>$123.45<PriceBarPriceInfo /></PriceBarPrice><PriceBarInfoDetails><PriceBarVat>Inc. VAT</PriceBarVat><PriceBarLink onClick={() => alert('Clicked Shipping Excluded button')}>Shipping Excluded</PriceBarLink></PriceBarInfoDetails></PriceBarMainInfo><PriceBarButtons><Dropdown rounded borderless><DropdownOption>100</DropdownOption><DropdownOption>200</DropdownOption><DropdownOption>300</DropdownOption></Dropdown><PriceBarMainButton onClick={() => alert('Clicked Continue button')}>Continue</PriceBarMainButton></PriceBarButtons></PriceBarMain></PriceBar>
"show banner" option
By default, the banner segments will be hidden on Small and Extra-Small screens. However, an adaptive design might require that for these screens, the banner be shown elsewhere on the page, separate from the regular Price Bar.
In this case, you can create a second Price Bar in a second location on the page, and add the "show-banner" option, which will force that Price Bar to show its banner (and only its banner) on all screens.
<PriceBar showBannerOnly><PriceBarBanner><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#1"src="https://via.placeholder.com/32/588da8/ffffff?text=1"/><PriceBarBannerSegmentText>Banner 1</PriceBarBannerSegmentText></PriceBarBannerSegment><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#2"src="https://via.placeholder.com/32/588da8/ffffff?text=2"/><PriceBarBannerSegmentText>Banner 2</PriceBarBannerSegmentText></PriceBarBannerSegment><PriceBarBannerSegment><PriceBarBannerSegmentImagealt="#3"src="https://via.placeholder.com/32/588da8/ffffff?text=3"/><PriceBarBannerSegmentText>Banner 3</PriceBarBannerSegmentText></PriceBarBannerSegment></PriceBarBanner></PriceBar>
Components
PriceBar
Prop | Type | Default | Description |
---|---|---|---|
showBannerOnly | boolean | By default, the banner segments will be hidden on Small and Extra-Small screens. However, an adaptive design might require that for these screens, the banner be shown elsewhere on the page, separate from the regular Price Bar. In this case, you can create a second Price Bar in a second location on the page, set this option to |
All other props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarBanner
PriceBarBanner
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarBannerSegment
PriceBarBannerSegment
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarBannerSegmentImage
PriceBarBannerSegmentImage
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <img/>
)
PriceBarBannerSegmentText
PriceBarBannerSegmentText
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarMain
PriceBarMain
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarMainInfo
PriceBarMainInfo
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarPrice
PriceBarPrice
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarPriceInfo
PriceBarPriceInfo
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarInfoDetails
PriceBarInfoDetails
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarVat
PriceBarVat
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarCouponCallout
PriceBarCouponCallout
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarLink
PriceBarLink
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <button/>
)
PriceBarButtons
PriceBarButtons
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarQuantity
PriceBarQuantity
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <div/>
)
PriceBarQuantityLabel
PriceBarQuantityLabel
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <label/>
)
PriceBarQuantityAmount
PriceBarQuantityAmount
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <span/>
)
PriceBarMainButton
PriceBarMainButton
has no props of its own
All props are forwarded to the element specified in thecomponent
prop(default: <button/>
)
Guidelines
Designer Guidelines
Banner icons should be 30 pixels tall.
Developer Guidelines
The Price Bar is typically pinned or sticky to the top or the bottom of the page. The component can't do this automatically, because it doesn't know which element you want it to be pinned to, so you will need to pin it yourself. Typically this involves:
If you want the bar pinned to the bottom of the window, place it in the page HTML as a direct child of the
<body>
tag or the.site-main
element, and give the Price Barposition: fixed
orposition: sticky
in your CSS, along with an appropriate CSS value such asbottom: 0
. If you useposition: fixed
, you will likely want to place some empty space at the bottom of that parent element so that the Price Bar does not overlap other page content when the page is scrolled down all the way.If you want the bar sticky to the top of the window, place it in the page HTML as a direct child of the
.site-main
element, and give the Price Barposition: sticky
in your CSS, along with an appropriate CSS value such astop: 0.
You can also place a Price Bar inside a modal dialog, using instructions similar to those above.
Accessibility Guidelines
Remember that any Dropdown inside a Price Bar is still bound by the Dropdown's accessibility considerations — notably, that the dropdown needs an accessible labeling element, even if that element is visually hidden.
.