Two region segmented control

A small two button pill that switches a page between two regions, each name carried in two scripts.

ControlsFreeFrom Noshi, Japan experienceChinese or JapaneseAbout 1k tokens saved
The whole page

Links in the preview stay on the block.

Open on its own

The prompt

One prompt, written to stand on its own: goal, structure, type, colour, spacing, behaviour and the words in square brackets to replace. Paste it into any tool that writes HTML. The Code tab has this block as one file.

701 words
Download .zip
# Two region segmented control

One controls component, not a whole page: build it to drop into a page that already exists. Works in Claude, v0, Lovable, Bolt, Cursor or any tool that writes HTML.

## Goal
A small pill of two buttons that switches a page between two regions, so dates, prices or availability change with it. For a delivery or regional pricing section.

## Structure
1. Div, role group, aria-label naming what it switches: inline flex, 4px padding, 1px border, pill radius.
2. Two buttons, type button, each with aria-pressed and a data attribute naming its region.
3. In each, 10px apart: the region name in the body face, then the same name in a second script with a lang attribute.
4. Below or beside it, the content that changes: a date range, a figure or a sentence.

## Type
Murecho 400, 15px for the labels, page 17px/1.8 at .02em letter spacing, 16px under 560px. Second script labels Kaisei Opti 500, 14px. Both free on Google Fonts.

## Colour
Page #F2F0F4, control #FFFFFF with a 1px #DCD7E0 border, labels #22182B. Pressed: #FFFFFF on #5A3A7A. Hovering the unpressed one fills #ECE8F0, the label still #22182B. Focus ring #5A3A7A. AA: #22182B on #FFFFFF and on #ECE8F0, #FFFFFF on #5A3A7A.

## Spacing and lines
Control padding 4px, radius 999px on it and both buttons. Buttons 42px tall, padding 0 22px, 0 16px under 560px, 10px between the two labels. The section takes a 1px top rule and clamp(120px,13vw,200px) of block padding, container 1320px with 0 clamp(20px,5vw,64px) of side padding, the control 40px from the heading beside it and wrapping under it when there is no room.

## Behaviour
Script needed. Clicking a button sets aria-pressed true on it and false on the other, then rewrites what it controls; run that same function once on load for the starting region, so the control and the page always agree. Background and colour change over .45s cubic-bezier(.7,0,.2,1); a press scales to .97 over .2s. Nothing happens on scroll into view.

## Responsive
Under 560px the button padding drops to 0 16px and the page to 16px. The control stays on one line at every width, so keep both labels to one or two words.

## Accessibility
Two buttons with aria-pressed inside a role group, not a radiogroup, so both stay reachable with Tab. The second script label carries its own lang attribute, so it is announced and rendered in the right face. Buttons are 42px tall inside 4px of padding, a 50px target. Focus ring 2px solid #5A3A7A, offset 3px. Reduced motion: the colours swap with no transition.

## Built values (from code.html)
- Fonts: Kaisei Opti 400, 500 (Google Fonts); Murecho 400, 500 (Google Fonts); Yuji Syuku (Google Fonts).
- Colour variables: --ground #F2F0F4, --ink #22182B, --muted #655D6B, --murasaki #5A3A7A, --murasaki-deep #432A5C, --line #DCD7E0, --card #FFFFFF.
- Font variables: --display "Kaisei Opti",serif; --text "Murecho",system-ui,sans-serif; --brush "Yuji Syuku",serif.
- Size variables: --g clamp(20px,5vw,64px), --nav 72px.
- Media queries: max-width 560px.
- No media files.
- Script: none, CSS only.

## Script
Set the Chinese or Japanese text in a CJK face with its own letter spacing and a looser line height than the Latin text, with strict line breaking and the palt feature on. Latin words inside a CJK line sit on the same baseline.

## Content to replace
- [Group label]: what the buttons switch
- [Region names]: two, one or two words
- [Second script names]: the same two names
- [Starting region]: which is pressed on load
- [What changes]: one sentence per region

## Rules
Plain, specific copy that reads as a live product; never the word sample. No shadows, glow, glass, blur, gradient text, emoji or italics. Motion moves transform and opacity, with colour, border, height and stroke transitions on state changes, and holds its end state under prefers-reduced-motion. Text passes WCAG AA.

## Output
Return the block in one piece: the markup, one style block with the web fonts imported on its first line, and a small script only if the behaviour needs one. No page wrapper, no framework, no build step. Prefix every class with `blk-` and put the colours and sizes in CSS variables at the top.

More like this

Controls

Every controls block

Same page

More from Noshi

See the page