shadcn.io is not affiliated with official shadcn/ui
Language Chips CTA Block for React
A split call to action for a product that speaks your users' language: the pitch and a Shine Button beside a framed greeting over a cloud of language chips that switch the greeting and the button's label, each in its own language and direction.
Installation
Overview
Show that your product speaks your users' language with this call to action for React with Base UI. Between the page's solid rails, a hairline divides two halves with + marks where it meets the top rule. On the start side are the headline, a line that counts the languages, the Shine Button and an outline link to the supported locales. On the end side, a framed figure with + marks on its corners shows a large sample greeting, over twelve language chips, each named in its own language, which form a radio group. Choosing a chip swaps the greeting and the Shine Button's label to that language, and each is set with its own lang and direction, so choosing Arabic flips the greeting and the button to right-to-left with the button's text aligned from the right. The chosen chip is filled in the foreground tone, so the button is the only primary control. On a phone the preview stacks under the pitch, with a rule between them. The count in the copy is the number of chips, not a typed number. It's built from Guides, Segment Group, Shine Button and Button, with nothing moving under reduced motion. Made for localisation features, internationalised apps, translation tools and any product where "it works in your language" is the pitch.
FAQ
How do I add or change a language?
Edit the LANGUAGES array at the top of the file: each language has a code, its own name, a sample greeting, the action label for the button and an rtl flag. The copy's "12 languages" is LANGUAGES.length, so it follows the list. Have a native speaker check the greeting and the label: the sample is the first thing a speaker of that language reads.
How does the right-to-left switch work?
Every greeting and button label carries its own lang and dir, so the browser shapes the script and orders the text itself, not the page. Choosing Arabic sets dir="rtl" on its greeting and on its button's link, and the rest of the block, set by your page's direction, stays put. To add Hebrew, Persian or Urdu, set rtl: true on its entry.
How do the chips work with a keyboard and a screen reader?
The chips are one radio group named "Preview language": Tab enters it once, the arrow keys move between chips and choose as they go, and Tab leaves it. Each chip's name is set in its own language, so a screen reader reads it with that language's voice. The chosen chip is filled; it isn't only colour, since a radio group also reports which one is checked. The greeting is a polite live region, so the change is announced without moving focus.
Does the block change size when the language does?
No. The greetings sit in one grid cell, and so do the button labels, all rendered at once with the unchosen ones invisible, hidden from assistive technology and, for the buttons, inert. The cell is as wide and tall as the longest greeting, so nothing below it moves and the focus order never meets a hidden link.
What do the two buttons do?
The Shine Button's label follows the chosen language and is a link to your product, so point href at your sign-up or app, optionally with the locale in the URL. The outline button is a fixed link to your list of supported locales.
Both buttons render the link they're given with render, with nativeButton={false}.
Will every script display correctly?
The browser falls back to a system font for scripts your site font doesn't cover, which is how Japanese, Korean, Chinese, Arabic and Hindi show here. If your brand font lacks a script, add a fallback stack that does for those lang values, for example with a :lang(ja) rule, so the greeting keeps a matching weight.
Related
- Pro
Pill Dual Action CTA
Prices and offersA band call to action: the saving of paying yearly beside one pill split into two linked halves (monthly in outline, yearly on the Shine Button), with a closing row of three figures worked out from the two prices.
- Pro
Dual Action CTA
Slim bandsA band call to action between solid rails with one split button: a Shine Button Get started link joined to a chevron that opens a menu of other routes, beside a headline and a sentence, in your theme.
- Pro
Icon Accent CTA
With a closing bandA band call to action with an accent icon in a hairline frame, a Shine Button and a docs link, and a closing band of three cells that fill in one by one when you press Deploy now.
- Pro
Feature Card Trio CTA
Pickers and togglesA split call to action on drafting lines for alert settings: a headline on one side of a hairline divider, and on the other three alert rows with a switch each, over a Shine Button whose label counts the alerts switched on.
- Pro
Centered Tech Icon Row Hero
Logos and social proofA showcase centered hero for an integrations story, with a headline, a sentence, a Shine Button and six tool tiles below on shared hairlines, each with what the product does with the tool.
- Pro
Centered Category Grid Hero
Features and tablesA centred showcase hero over a grid of eight category links, each its own hairline cell with an icon, a short description and a template count.