Skip to main content
The @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

Requires react and react-dom as peer dependencies (v17, v18, or v19).

Quick start

Wrap your app with KQProvider and place KQBanner where you want the banner to appear.
Never expose your Server API Key in the browser. Use the Client API Key, which is safe for client-side code. You can find both keys under Settings → API keys in the Kelviq dashboard.

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 optional config prop accepts:

Sandbox

Set environment 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

Props override the corresponding values returned by the API. If you don’t pass a prop, the dashboard-configured value is used.

Template variables

The banner message (configured in the dashboard) supports these placeholders: Example message:

CSS hooks

The banner adds classes to document.body that you can target in your stylesheets:

Unstyled mode

Set unStyled={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 a KQProvider.

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).

Custom price layout example

Combine granular components to build a fully custom price display:

Complete example


Support

For technical support and questions, reach out at hi@kelviq.com.