CountryRedirect
Dismissible banner suggesting a redirect to the visitor's detected country store. Persists dismissal in localStorage.
Best for
Import
import { CountryRedirect } from "@enadhq/enad-react-sdk/client/storefront"When to use it
Use CountryRedirect when the storefront serves multiple country-specific stores and you want to suggest visitors switch to their local version. It detects a mismatch between the visitor's country and the current store, then shows a dismissible banner.
Composition notes
CountryRedirect is a self-contained banner:
detectedCountryandcurrentCountryare objects withcode,name, and optionalflag. The banner only shows if they differ.redirectUrlis where the accept button navigates.onAcceptandonDismissare optional callbacks for analytics or custom behavior.persistKeycontrols the localStorage key for dismissal persistence. Set tofalseto disable persistence.labelslets you customize the message, accept, and dismiss button text.
Behavior and theming guidance
The banner renders nothing if countries match or if the visitor previously dismissed it (checked via localStorage). On accept, it navigates to redirectUrl. On dismiss, it hides and persists the dismissal.
Keep the message short and the country names localized. The banner should feel helpful, not intrusive.
Examples
Live examples you can edit directly in the sandbox.
Country redirect banner
A banner that appears when the detected country differs from the current store. Dismissal is persisted so it only shows once.
Component Sets
Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| detectedCountry | CountryInfo | — | The country detected from the visitor's location |
| currentCountry | CountryInfo | — | The country the store is currently serving |
| redirectUrl | string | — | URL to redirect to for the detected country's store |
| onAccept | string | — | Called before navigating to the redirect URL |
| onDismiss | string | — | Called when the visitor dismisses the banner |
| persistKey | string | — | localStorage key for persisting dismissal. Set to `false` to disable persistence. |
| labels | string | {} | No description yet. |
| className | string | — | No description yet. |