elements
Blog Demos UI Docs Pricing
Elements Manual
  • Getting Started
  • CLI
  • Build
  • Browser
  • Packages
  • TypeScript
  • Elements HTML
  • Assets
  • RPC
  • Router
  • Session
  • Database
  • Migrations
  • LiveTable
  • Channel
  • Jobs
  • Email
  • Payments
  • JSON
  • Async
  • Style
    • Install
    • Tokens
    • Base elements
    • Typography
    • Layout
    • Components
    • Utilities
    • Theming
    • Overriding
    • Email
    • Reference
  • UI
  • JSOC
  • Config
  • Tests
  • Logs
  • Deploy
  • Editors
  • Recipes
  • Licenses
Manual / Style/ Components/ Tabs

Tabs

elements man style/components/tabs

Underline-style tabs. This is tabs.css in @layer components.

Tabs
<div class="tabs"> <div class="tab-list"> <button class="tab is-active">General</button> <button class="tab">Billing</button> </div> <div class="tab-panel">General settings…</div> </div>

Parts

Class Role
.tabs The container (a vertical flex column)
.tab-list The row of tabs with a bottom rule
.tab A single tab: quiet by default, an accent underline when active
.tab.is-active The current tab: --ink text and an accent bottom border
.tab-panel The content region below the list

A .tab is typically a <button>, but the styling works on any element you give the class.

Switching panels

Keep the current tab in a private attribute, set it from each tab's onclick, and show the matching panel with e:if. The styling supplies the look and the is-active hook, and the switching lives in the template because that is where the page's state lives:

Tabs
<html (private tab: string = "general")> <div class="tabs"> <div class="tab-list"> <button class={["tab", tab === "general" && "is-active"]} onclick={() => tab = "general"}>General</button> <button class={["tab", tab === "billing" && "is-active"]} onclick={() => tab = "billing"}>Billing</button> </div> <div class="tab-panel" e:if={tab === "general"}>General settings…</div> <div class="tab-panel" e:elseif={tab === "billing"}>Billing settings…</div> </div> </html>
Prev PillNext Terminal
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026