Skip to content
Focsd homeFocsd homeFocsd
Forms

Tabs

Related panels on one page, one shown at a time.

  • Tag: focsd-tabs
  • Pattern: Tabs
  • Category: Navigation

Example

General Members Billing Security

Name, region and default language for the workspace.

Invite people and change their roles.

Billing is managed by your organization.

Two-factor authentication and session length.

HTML
<div class="full">
<focsd-tabs label="Workspace settings">
<focsd-tab>General</focsd-tab>
<focsd-tab>Members</focsd-tab>
<focsd-tab disabled>Billing</focsd-tab>
<focsd-tab>Security</focsd-tab>
<focsd-tab-panel
><p>Name, region and default language for the workspace.</p></focsd-tab-panel
>
<focsd-tab-panel><p>Invite people and change their roles.</p></focsd-tab-panel>
<focsd-tab-panel><p>Billing is managed by your organization.</p></focsd-tab-panel>
<focsd-tab-panel
><p>Two-factor authentication and session length.</p></focsd-tab-panel
>
</focsd-tabs>
</div>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-tabs.js';
</script>
<focsd-tabs label="Workspace settings">…</focsd-tabs>

API

Attributes

AttributePropertyTypeDefault
selectedselectednumber0
labellabelstring—

Events

EventDescription
changeFired when the user commits a change to the value or state.

Slots

SlotDescription
(default)Default content.
tabThe focsd-tab elements (assigned to this slot automatically).

CSS parts

Style the inside of the component with ::part(), for example focsd-tabs::part(panels).

PartDescription
panelsThe panels element.
tablistThe tablist element.

Accessibility

  • APG tabs with automatic activation: role="tablist", tab and tabpanel, with aria-selected, aria-controls and aria-labelledby set on the hosts.
  • One tab stop for the tab list; disabled tabs are skipped; arrows are mirrored in right-to-left pages.

Keyboard

KeyAction
Arrow Left / RightPrevious / next tab (selects it)
Home / EndFirst / last tab
TabMove into the active panel