Skip to content
Viewership Inquire
UI Components

Tabs.

Pill tab list with a sliding thumb and full keyboard support, one named slot per panel.

NavigationComponentNo dependencies Original, MIT

.md

38citations this week

Most came from the rewax guide and two Reddit threads about winter packs.

Using Claude Code? Give it the agent prompt and skip these steps.

  1. Import the foundation once

    foundation.css holds the tokens every component reads.

    Layout.astro
    ---
    // src/layouts/Layout.astro
    import "../styles/foundation.css";
    ---
  2. Copy Tabs.astro

    Paste into src/components/viewership/tabs/

  3. Use it

    Page.astro
    ---
    import Tabs from "../components/viewership/tabs/Tabs.astro";
    ---
    
    <Tabs />

Props 5

PropTypeDefaultDescription
tabs { id: string; label: string }[] · The tabs, in order. Each id names a slot.
label string · Accessible name for the tab list.
selected string · Id of the tab selected on load (default: first).
full boolean false Stretch the tab list to the full width.
slot: <id> slot · Panel content for the tab with that id.

Events

EventDetailWhen
vs-change CustomEvent<{ id: string; index: number }> Fires when the selected tab changes.

Source 1 file

Original, MIT.