babelize/babelize-elements
소개
Open-source Localization UI components — copy-paste React & Tailwind for language switchers, locale pickers, translation widgets, and more.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
Babelize Elements
Open-source Localization UI components for React and Tailwind CSS.
Ready-to-use components for language switchers, locale pickers, translation widgets, and more — built by the community.
elements.babelize.co · Issues · Contributing
What is Babelize Elements?
Babelize Elements is a community-built library of Localization UI components for React and Tailwind CSS. Every localized app needs a language switcher, a locale picker, RTL-aware layouts, and pluralization UI — Elements turns that repetitive work into a shared, open-source toolbox.
- Easy to install —
npm install @babelize/elementsfor the full library, or add components one at a time withnpx shadcn@latest add @babelize/<component>. - No framework lock-in — plain React and Tailwind. No Next.js, no router, no theme provider required.
- Localization-first — pluralization, RTL, and locale data built into every component.
- Accessible — keyboard support, ARIA labels, and WCAG-aware markup.
- Open source — MIT-licensed, free forever, built by contributors like you.
Need the rest of your app translated too? Elements gives you the language switcher; Babelize does the rest. It finds the hardcoded text in your React or Next.js app, wraps it in i18n calls, translates it into 90+ languages and opens a pull request you review, then keeps new strings translated on every push. Free plan, or try it locally with
npx babelize.
Installation
Full library
npm install @babelize/elements
Tailwind does not scan node_modules, so point it at the package once — otherwise
the components render unstyled:
/* Tailwind v4 — in the CSS file that imports Tailwind */
@import "tailwindcss";
@source "../node_modules/@babelize/elements/dist";
// Tailwind v3 — in tailwind.config.js
content: ["./src/**/*.{ts,tsx}", "./node_modules/@babelize/elements/dist/**/*.js"],
Components are styled with shadcn/ui theme tokens. In a shadcn project they pick up your theme automatically; otherwise add the tokens once — see Theme tokens.
Components installed with the CLI below live in your own source tree, so they need no extra Tailwind config.
Individual components
Install a component with the shadcn CLI — @babelize is in the official shadcn registry directory, so no setup is needed:
npx shadcn@latest add @babelize/language-switcher
Or with the CLI bundled in @babelize/elements:
npx @babelize/elements add language-switcher
Usage
Every component works uncontrolled (pass defaultValue) or controlled (pass value
and onValueChange).
import { LanguageSwitcher, PhoneInput, NavBar } from "@babelize/elements";
The components are client components, and the package declares "use client" for
you — importing them from a React Server Component works without any extra wrapper.
The cn helper is also available from @babelize/elements/utils, which carries no
directive and so can be called from server code.
LanguageSwitcher
<LanguageSwitcher
locales={[{ code: "en" }, { code: "fr" }, { code: "ar" }]}
defaultValue="en"
showFlags
onValueChange={(code) => router.push(`/${code}`)}
/>
| Prop | Type | Default | Description |
|---|---|---|---|
locales |
Locale[] |
— | Available locales. Only code is required; labels, flags, and RTL are auto-detected. |
value |
string |
— | Selected locale code. Pass this to control the component. |
defaultValue |
string |
first locale | Initial locale code when uncontrolled. |
onValueChange |
(code: string) => void |
— | Fired once per selection. |
showFlags |
boolean |
false |
Show flag emojis beside locale names. |
label |
"native" | "english" |
"english" |
Render locale names natively or in English. |
PhoneInput
<PhoneInput
defaultCountry="IN"
name="phone"
onValueChange={(phone, country) => console.log(country.dialCode + phone)}
/>
| Prop | Type | Default | Description |
|---|---|---|---|
value |
string |
— | Phone number. Pass this to control the component. |
defaultValue |
string |
"" |
Initial number when uncontrolled. |
onValueChange |
(phone: string, country: Country) => void |
— | Fired on typing and on country change. |
defaultCountry |
string |
"US" |
ISO 3166-1 alpha-2 code of the initial country. |
showFlags |
boolean |
true |
Show the flag emoji beside the dial code. |
The ref points at the underlying <input>, and name, required, and other input
attributes pass straight through — so it works in a plain HTML form.
NavBar
NavBar renders plain <a> elements by default. Pass linkComponent to get
client-side navigation from your router:
import Link from "next/link";
<NavBar
logo={<Logo />}
links={[{ label: "Docs", href: "/docs" }]}
locales={[{ code: "en" }, { code: "fr" }]}
value={locale}
onValueChange={setLocale}
linkComponent={Link}
cta={{ label: "Get started", href: "/docs" }}
/>;
Full props for every component are documented at elements.babelize.co.
Documentation
Full documentation, guides, and live component demos live at elements.babelize.co, built with Next.js and Fumadocs from this same repo.
Local development
bun install
bun run dev # docs site at http://localhost:3000
bun run test # component tests
bun run typecheck
bun run lint
bun run build:lib # build the publishable library into dist/
bun run test:pack # install the packed tarball into a scratch project
Contributing a component
Components are contributed by the community. The typical flow:
- Read ARCHITECTURE.md for the codebase layout and component conventions.
- Pick an open issue — look for
good first issueorhelp wanted. - Build the component in
src/registry/components/. - Open a pull request following our contributing guide.
- Maintainers review it, and merged components ship to the docs for everyone.
Great component candidates:
- Language switchers (dropdowns, pills, searchable)
- Locale pickers (regions, currencies, date formats)
- Translation widgets and inline editors
- RTL-aware layout primitives
- Locale-aware date/time pickers
- Pluralization helpers and CLDR plural-rule UI
- Locale-aware currency inputs
Community
Contributors
Babelize Elements is built by an amazing community of designers, developers, and translators. A huge thank-you to everyone who contributes code, reviews, docs, or ideas.
Star History
License
관련 프로젝트 살펴보기
불러오는 중…