ZUI

Search documentation

Find a page or a heading.

Language toggle group

Every language shown inline as a single-choice toggle group, which never deselects so a language is always chosen.

Installation

bash

The CLI writes components/data-entry/language-toggle-group.tsx and installs Toggle group with the items it needs.

Usage

tsx
tsx

Compose one ToggleGroupItem per option, as the group's direct children. Use it for a small, fixed set of two to four languages; for a longer or searchable list, use a Combobox instead.

API reference

LanguageToggleGroup

Takes every prop of ToggleGroup except type, which it fixes to single, and value and onValueChange, which are redefined:

It is announced as a radio group, named by its aria-label, and each item as a radio, checked while its value equals the group's. Pressing the checked item reports nothing, so a language is always chosen. It defaults variant to outline and keeps the toggle group's default spacing.

Differences from the web

  • Its label goes in each item as a Text child, where the web's item takes the string itself.
  • The web's data-slot attribute is not set; a View takes no data attributes.