LangSwitcher Component
Add a language switcher to let users change your site language
Overview
The LangSwitcher component gives your users a simple way to change your site's display language. Once installed, you can drop it anywhere in your app.
Installation Options
There are two ways to add the LangSwitcher to your project:
Option 1: Use the CLI (Recommended)
The easiest approach—Stringer will generate a component tailored to your project's setup (Tailwind vs. vanilla CSS, TypeScript vs. JavaScript, etc.):
- Run
stringer - Select Add LangSwitcher Component
- The component is injected into your
/componentsfolder automatically
Option 2: Copy & Paste
If you prefer to grab the code manually:
- Visit stringer-cli.com/components
- Preview the available variants
- Copy your preferred version into your project
Usage
Once installed, use the component anywhere in your templates:
Suggested Placement
We recommend placing the LangSwitcher in your site header, typically on the right side before any existing items (like user menu or login button):
Customization
The generated component comes with sensible defaults, but you can customize:
- Styling — Adjust colors, spacing, and sizing to match your design
- Dropdown behavior — Modify open/close animations
- Flag icons — Add or remove country flags for each language
Next Steps
- Commands Reference — View all CLI commands
- Frameworks — Framework-specific setup guides
- Configuration — Manage your project settings