New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/tabs

Package Overview
Dependencies
Maintainers
5
Versions
327
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/tabs

The `<sp-tabs>` displays a list of `<sp-tab>` element children which accept both a `label` attribute and a `[slot="icon"]` child to define their contents. `<sp-tab>` content can be further customized with the `vertical` attribute which stacks them in the

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-16.19%
Maintainers
5
Weekly downloads
 
Created
Source

Description

The <sp-tabs> displays a list of <sp-tab> element children which accept both a label attribute and a [slot="icon"] child to define their contents. <sp-tab> content can be further customized with the vertical attribute which stacks them in the UI rather than listing them in a row. <sp-tabs> is typically used as the interface for controlling a set of layered sections of content that display one panel of content at a time

Usage

See it on NPM! How big is this package in your project?

yarn add @spectrum-web-components/tabs

Import the side effectful registration of <sp-tabs> or <sp-tab> via:

import '@spectrum-web-components/tabs/sp-tabs.js';
import '@spectrum-web-components/tabs/sp-tab.js';

When looking to leverage the Tabs or Tab base class as a type and/or for extension purposes, do so via:

import {
    Tabs,
    Tab
} from '@spectrum-web-components/tabs';

Example

<sp-tabs selected="1">
    <sp-tab label="Tab 1" value="1"></sp-tab>
    <sp-tab label="Tab 2" value="2"></sp-tab>
    <sp-tab label="Tab 3" value="3"></sp-tab>
    <sp-tab label="Tab 4" value="4"></sp-tab>
</sp-tabs>

Vertical

<sp-tabs selected="1" direction="vertical">
    <sp-tab label="Tab 1" value="1"></sp-tab>
    <sp-tab label="Tab 2" value="2"></sp-tab>
    <sp-tab label="Tab 3" value="3"></sp-tab>
    <sp-tab label="Tab 4" value="4"></sp-tab>
</sp-tabs>

Variants

Quiet

<sp-tabs selected="1" quiet>
    <sp-tab label="Tab 1" value="1"></sp-tab>
    <sp-tab label="Tab 2" value="2"></sp-tab>
    <sp-tab label="Tab 3" value="3"></sp-tab>
    <sp-tab label="Tab 4" value="4"></sp-tab>
</sp-tabs>

Compact

<sp-tabs selected="1" compact>
    <sp-tab label="Tab 1" value="1"></sp-tab>
    <sp-tab label="Tab 2" value="2"></sp-tab>
    <sp-tab label="Tab 3" value="3"></sp-tab>
    <sp-tab label="Tab 4" value="4"></sp-tab>
</sp-tabs>

With icons

<div>
    <sp-icons-medium></sp-icons-medium>
    <sp-tabs selected="1" direction="horizontal">
        <sp-tab label="Tab 1" value="1">
            <sp-icon slot="icon" size="s" name="ui:CheckmarkSmall"></sp-icon>
        </sp-tab>
        <sp-tab label="Tab 2" value="2">
            <sp-icon slot="icon" size="s" name="ui:CrossSmall"></sp-icon>
        </sp-tab>
        <sp-tab label="Tab 3" value="3">
            <sp-icon slot="icon" size="s" name="ui:ChevronDownSmall"></sp-icon>
        </sp-tab>
        <sp-tab label="Tab 4" value="4">
            <sp-icon slot="icon" size="s" name="ui:HelpSmall"></sp-icon>
        </sp-tab>
    </sp-tabs>
</div>

Accessibility

When an <sp-tabs> has a selected value, the <sp-tab> child of that value will be given [tabindex="0"] and will receive initial focus when tabbing into the <sp-tabs> element. When no selected value is present, the first <sp-tab> child will be treated in this way. When focus is currently within the <sp-tabs> element, the left and right arrows will move that focus back and forth through the available <sp-tab> children.

Keywords

FAQs

Package last updated on 31 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc