1 GitHub star = 1 new component.

Navigation languagepickeri18n

Language Picker Pill

Pill-style language switcher with locale code triggers.

Live Preview

EN
ES FR JP

Usage

Copy and paste this code into your Astro page:

astro
---
import { LanguagePickerPill } from 'astro-component-kit';
---

<LangSwitcherPill>Content</LangSwitcherPill>
--- import { LanguagePickerPill } from 'astro-component-kit'; --- <LangSwitcherPill>Content</LangSwitcherPill>

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/lib/LanguagePickerPill.astro:

astro
---
---
<div class="lang-pill">
  <span class="curr">EN</span>
  <div class="list">
    <span>ES</span>
    <span>FR</span>
    <span>JP</span>
  </div>
</div>
<style>
  .lang-pill { background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 100px; color: #fff; font-size: 0.75rem; font-weight: 800; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; position: relative; }
  .list { position: absolute; top: 110%; left: 0; background: #111; border-radius: 8px; border: 1px solid #333; display: none; flex-direction: column; z-index: 10; }
  .lang-pill:hover .list { display: flex; }
  .list span { padding: 5px 15px; }
  .list span:hover { background: #6366f1; }
</style>
--- --- <div class="lang-pill"> <span class="curr">EN</span> <div class="list"> <span>ES</span> <span>FR</span> <span>JP</span> </div> </div> <style> .lang-pill { background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 100px; color: #fff; font-size: 0.75rem; font-weight: 800; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; position: relative; } .list { position: absolute; top: 110%; left: 0; background: #111; border-radius: 8px; border: 1px solid #333; display: none; flex-direction: column; z-index: 10; } .lang-pill:hover .list { display: flex; } .list span { padding: 5px 15px; } .list span:hover { background: #6366f1; } </style>

Quick Info

Category
Navigation
Filename
LanguagePickerPill.astro
Dependencies
None — pure Astro + CSS
Tags
languagepickeri18n