@kelviq/react-promotions-ui SDK provides React components for displaying location-based promotional banners and dynamically discounted prices. It handles API communication, discount calculation, and currency formatting out of the box.
- A React Context Provider (
KQProvider) to fetch and share promotion data - A banner component (
KQBanner) with template variables and full styling control - Price components for formatted display of discounted prices
- Granular price components for building fully custom price layouts
This SDK is separate from the entitlements React SDK and the React UI SDK. Use this SDK when you need PPP / country-based discount banners and price display in a React app.
Installation
react and react-dom as peer dependencies (v17, v18, or v19).
Quick start
Wrap your app withKQProvider and place KQBanner where you want the banner to appear.
KQProvider
The provider initializes the SDK, fetches promotion data from the Kelviq API, and makes it available to all child components via React Context.
Props
Advanced config
The optionalconfig prop accepts:
Sandbox
Setenvironment to 'sandbox' to test against the Kelviq sandbox environment:
KQBanner
Displays a location-aware promotional banner. The banner message is configured in the Kelviq dashboard and supports template variables that are automatically replaced with real data.
Props
Template variables
The banner message (configured in the dashboard) supports these placeholders:
Example message:
CSS hooks
The banner adds classes todocument.body that you can target in your stylesheets:
Unstyled mode
SetunStyled={true} to remove all default styles and apply your own CSS from scratch. Target the banner using the kq-banner CSS class or the data-testid="kq-banner" attribute.
KQPriceFormatted
Displays a fully formatted discounted price based on the visitor’s location.
Props
Original + discounted price
Show a strikethrough original price next to the discounted price:Granular price components
Use these components individually to build custom price layouts with full styling control. All components must be rendered inside aKQProvider.
KQPriceInteger
Displays just the integer part of the discounted price.
KQPriceDecimal
Displays just the decimal portion of the discounted price.
KQPriceDecimalSeparator
Renders the locale-specific decimal separator (e.g. . or ,).
KQPriceCurrencySymbol
Renders the currency symbol (e.g. $, €, ₹).
KQPriceCurrencyCode
Renders the currency code (e.g. USD, EUR, INR).