shadcn.io is not affiliated with official shadcn/ui
Location Consent Alert Banner Block for React
A region callout for a storefront: two cells split by a divider, a map pin and a live line at the start, and a US, EU and UK segment control at the end that rewrites the currency, tax and delivery line.
Installation
Overview
A region callout for React with Base UI, for a shop that prices by where the visitor is. A band of two cells, split by a solid divider that meets the page's top rule: at the start a map pin, a short heading and one live line; at the end a segment control with three regions (US, EU, UK). Choosing a region rewrites the line in place with that region's currency, tax and delivery window, in a cell that keeps its height, and the choice stays while the page is open. On phones the cells stack under a rule and the control spans the width. The pin carries the info token; the text and the control follow your theme. The page's rails and top rule come from the Guides spine. It's built from Guides and Segment Group, with your theme's tokens for every colour. For regional pricing, shipping and tax notices, language and currency prompts.
FAQ
Does a screen reader hear the line change?
Yes. The line is a polite live region that is in the page from the start, so choosing a region announces the new sentence once and nothing is read at load. The sentence names the region first ("Europe: prices in EUR…") because the segments themselves are only "US", "EU" and "UK".
How do I add a region or change a line?
Edit REGIONS at the top of the file: each region is a code, the label on its segment and the line it shows. The control and the live line follow the data. Keep each line to about one sentence: the cell reserves two lines on phones and one from sm, so a longer sentence would move the page when you switch.
What does choosing a region actually change?
Only the line, in this block: it is the control and the message. To change real prices, read the selected code where you format money and compute tax, and store it for the next visit (a cookie that your server reads, so the first paint is already right). The block doesn't read the visitor's location or ask for permission.
Why a segment control and not a select?
Three short choices are better seen than hidden, and one tap does it. A segment control also keeps the current region visible all the time. For more than about four regions use a select instead: the segments won't fit a phone.
Related
- Pro
An acknowledge-once callout for a newsletter platform: a card in card with an info icon, a heading, one sentence and a footer whose checkbox rewrites the outline button from Got it to Dismiss permanently.
- Pro
A setting callout for an uptime monitor: a card in card with a bell icon, a heading and a sentence, and an Off or On label beside a switch that rewrites the sentence and lights a status dot.
- Pro
Info Alert Banner
AlertsAn in-page info callout for an invoicing app: a card in card with an info icon, a heading, two sentences about a change coming next month, a Shine Button link and a dismiss button that folds the block away.
- Pro
Dropdown Multi-Action Banner
Choices and promptsA region prompt for a data platform: a Select of four regions with their latency beside a Shine Button Continue and a ghost Skip, with a line that says why Continue waits.
- Pro
Language Switch Top Bar Banner
Top barsA top bar for a news site that translates itself: one line in English, Spanish or Arabic, with an underlined button that switches the line to the next language and flips it to right to left for Arabic.
- Pro
Cookie Consent Multi-Action Banner
Choices and promptsA cookie prompt for an online shop: one split card with a stack of three equal-width choices, Accept all, Reject non-essential and Manage preferences.