lunaDOM Docs
lunaDOM Docs

lunaDOM is a collection of lightweight, accessible shadowdom based web components built with JavaScript.

v0.0.25

The <luna-tab-group>, <luna-tab>, and <luna-tab-panel> components provide tab navigation with multiple placements and closable tabs.

Paths

/lunadom/components/tab/tab.js REQUIRED
/lunadom/components/tab-group/tab-group.js REQUIRED
/lunadom/components/tab-panel/tab-panel.js REQUIRED

Standard Top (with Closable Tabs)

General Statistics Settings Restricted

Welcome to the general info panel. This is where you can view overview information and get started with the basics.

Here are some shiny graphs and numbers. View analytics and performance metrics for your account.

Tweak your preferences here. Customize your experience and manage account settings.

Bottom Placement

Overview Details History

Content for the overview tab with indicator on bottom.

Detailed information and specifications go here.

Historical data and previous activity records.

Start Placement (Vertical)

Profile Billing Security

Manage your user profile details, avatar, and personal information.

View and manage your subscription, payment methods, and billing history.

Configure two-factor authentication and security preferences.

Custom Styling

Dashboard Analytics Reports

Dashboard content with custom green accent color.

Analytics and insights with enhanced spacing.

Generate and view detailed reports.

Customization

Slots

luna-tab-group

nav - The container for luna-tab components.
default - The container for luna-tab-panel components.

luna-tab

default - The label for the tab.

luna-tab-panel

default - The content of the tab panel.

Attributes

luna-tab-group

placement - Position of tab nav (top, bottom, start, end). Defaults to 'top'.
no-scroll - Disables overflow scrolling on nav strip; tabs wrap instead.

luna-tab

active - Whether the tab is currently active.
disabled - Whether the tab is disabled.
closable - Shows a close button next to the tab label.
panel - The name of the luna-tab-panel this tab activates.

luna-tab-panel

name - The unique identifier for this panel, matched by the 'panel' attribute of a luna-tab.
active - Whether the panel is currently visible.

CSS Variables

luna-tab-group

--luna-tab-group-bg - Background of the whole component. Defaults to transparent.
--luna-tab-group-border - Color of the nav/panel divider line. Defaults to #222.
--luna-tab-group-nav-bg - Background of the nav strip. Defaults to transparent.
--luna-tab-group-nav-padding - Inline padding of the nav strip. Defaults to 0 0.25rem.
--luna-tab-scroll-button-size - Width of overflow scroll buttons. Defaults to 2rem.
--luna-accent - Accent color forwarded to tabs. Defaults to #2563eb.

luna-tab

--luna-tab-color - Default tab text color. Defaults to #555.
--luna-tab-color-hover - Tab text color on hover. Defaults to #ccc.
--luna-tab-color-active - Active tab text color. Defaults to #fff.
--luna-tab-font-size - Tab label font size. Defaults to 0.8125rem.
--luna-tab-font-weight - Tab label font weight. Defaults to 500.
--luna-tab-padding - Tab padding. Defaults to 0.75rem 1.25rem.
--luna-tab-indicator - Active indicator color. Defaults to var(--luna-accent, #2563eb).
--luna-tab-hover-bg - Hover background tint. Defaults to rgba(255,255,255,.03).

Events

luna-tab-group

luna-tab-show - Fired when a tab is activated. detail: { tab, name }

luna-tab

luna-close - Fired when the close button is clicked. detail: { tab }

Example Code

<!-- Standard Top with Closable Tabs --> <luna-tab-group> <luna-tab slot="nav" panel="general" active>General</luna-tab> <luna-tab slot="nav" panel="stats" closable>Statistics</luna-tab> <luna-tab slot="nav" panel="settings" closable>Settings</luna-tab> <luna-tab slot="nav" panel="danger" disabled>Restricted</luna-tab> <luna-tab-panel name="general">Welcome to the general info panel.</luna-tab-panel> <luna-tab-panel name="stats">Here are some shiny graphs and numbers.</luna-tab-panel> <luna-tab-panel name="settings">Tweak your preferences here.</luna-tab-panel> </luna-tab-group> <!-- Bottom Placement --> <luna-tab-group placement="bottom"> <luna-tab slot="nav" panel="tab1">Tab 1</luna-tab> <luna-tab slot="nav" panel="tab2">Tab 2</luna-tab> <luna-tab-panel name="tab1">Content for Tab 1</luna-tab-panel> <luna-tab-panel name="tab2">Content for Tab 2</luna-tab-panel> </luna-tab-group> <!-- Start Placement (Vertical) --> <luna-tab-group placement="start"> <luna-tab slot="nav" panel="v1">Profile</luna-tab> <luna-tab slot="nav" panel="v2">Billing</luna-tab> <luna-tab-panel name="v1">User profile details...</luna-tab-panel> <luna-tab-panel name="v2">Manage your subscription.</luna-tab-panel> </luna-tab-group>