Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@material/tab-bar

Package Overview
Dependencies
Maintainers
15
Versions
1652
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/tab-bar

The Material Components for the web tab bar component

  • 14.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
15
Created

What is @material/tab-bar?

@material/tab-bar is a package from Material Design Components (MDC) that provides a tab bar component. This component allows for the creation of tabbed navigation interfaces, which are commonly used in web applications to organize content into different sections.

What are @material/tab-bar's main functionalities?

Basic Tab Bar

This code initializes a basic tab bar using the @material/tab-bar package. The MDCTabBar class is used to create a tab bar component, which is then attached to an HTML element with the class 'mdc-tab-bar'.


import { MDCTabBar } from '@material/tab-bar';

const tabBar = new MDCTabBar(document.querySelector('.mdc-tab-bar'));

Tab Bar with Icons

This code demonstrates how to create a tab bar with icons. The HTML structure includes tabs with both icons and text labels, which are styled using Material Design classes.


import { MDCTabBar } from '@material/tab-bar';

const tabBar = new MDCTabBar(document.querySelector('.mdc-tab-bar'));

// HTML structure
// <div class="mdc-tab-bar">
//   <div class="mdc-tab">
//     <span class="mdc-tab__icon material-icons">favorite</span>
//     <span class="mdc-tab__text-label">Favorites</span>
//   </div>
//   <div class="mdc-tab">
//     <span class="mdc-tab__icon material-icons">person</span>
//     <span class="mdc-tab__text-label">Profile</span>
//   </div>
// </div>

Scrollable Tab Bar

This code shows how to create a scrollable tab bar. The 'mdc-tab-bar--scrollable' class is added to the tab bar element to enable horizontal scrolling for tabs that overflow the container.


import { MDCTabBar } from '@material/tab-bar';

const tabBar = new MDCTabBar(document.querySelector('.mdc-tab-bar'));

// HTML structure
// <div class="mdc-tab-bar mdc-tab-bar--scrollable">
//   <div class="mdc-tab">
//     <span class="mdc-tab__text-label">Tab 1</span>
//   </div>
//   <div class="mdc-tab">
//     <span class="mdc-tab__text-label">Tab 2</span>
//   </div>
//   <!-- More tabs -->
// </div>

Other packages similar to @material/tab-bar

Keywords

FAQs

Package last updated on 28 Apr 2022

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