npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@miraidesigns/tabs

v1.0.0

Published

Mirai Designs Framework: Tabs module

Downloads

5

Readme

Tabs

Tabs allow you to organize content into different panels or screens.


HTML

<div class="mdf-tabs">
    <div class="mdf-tabs__bar">
        <button class="mdf-tabs__tab mdf-tabs__tab--selected" role="tab" aria-selected="true">
            <span class="mdf-tabs__content">
                <span class="mdf-tabs__text">Tab 1</span>
            </span>

            <span class="mdf-tabs__selection"></span>
        </button>

        <button class="mdf-tabs__tab" role="tab" aria-selected="false" tabindex="-1">
            <span class="mdf-tabs__content">
                <span class="mdf-tabs__text">Tab 2</span>
            </span>

            <span class="mdf-tabs__selection"></span>
        </button>

        <button class="mdf-tabs__tab" role="tab" aria-selected="false" tabindex="-1">
            <span class="mdf-tabs__content">
                <span class="mdf-tabs__text">Tab 3</span>
            </span>

            <span class="mdf-tabs__selection"></span>
        </button>
    </div>

    <div class="mdf-tabs__panels">
        <div class="mdf-tabs__panel mdf-tabs__panel--active" role="tabpanel" tabindex="0">
            Panel 1
        </div>

        <div class="mdf-tabs__panel" role="tabpanel" tabindex="0">
            Panel 2
        </div>

        <div class="mdf-tabs__panel" role="tabpanel" tabindex="0">
            Panel 3
        </div>
    </div>
</div>

Sass

// Include default styles without configuration
@forward '@miraidesigns/tabs/styles';
// Configure appearance
@use '@miraidesigns/tabs' with (
    $variable: value
);

@include tabs.styles();

TypeScript

import { MDFTabs } from '@miraidesigns/tabs';

new MDFTabs(document.querySelector('.mdf-tabs'));

Implementation

Attributes

Please see the WAI-ARIA page for attributes and best practices regarding tabs.

Classes

| Name | Type | Description | | -------------------------- | -------------- | ------------------------------------------------------------------------ | | mdf-tabs | Parent | Contains the tabs elements | | mdf-tabs__bar | Parent / Child | Horizontal grid containing the tabs. Child to .mdf-tabs | | mdf-tabs__bar--left | Modifier | Move the tabs to the left of the grid | | mdf-tabs__bar--right | Modifier | Move the tabs to the right of the grid | | mdf-tabs__bar--stretched | Modifier | Evenly stretch the tabs across the entire container width | | mdf-tabs__tab | Parent / Child | Contains the tab content. Child to .mdf-tabs__bar | | mdf-tabs__tab--selected | Modifier | Set tab as selected | | mdf-tabs__tab--stacked | Modifier | Moves the icon on top of the text | | mdf-tabs__content | Parent / Child | Contains the tab text, icon and selection bar. Child to .mdf-tabs__tab | | mdf-tabs__text | Child | Tab text description. Child to .mdf-tabs__content | | mdf-tabs__selection | Child | Selection bar, shows active tab. Child to .mdf-tabs__content | | mdf-tabs__panels | Parent / Child | Contains the tab panel elements. Child to .mdf-tabs | | mdf-tabs__panel | Child | Tab panel element. Child to .mdf-tabs__panels | | mdf-tabs__panel--active | Child | Set panel as active |

Events

| Name | Data | Description | | ----------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | MDFTabs:changed | {index: number, tab: HTMLElement, panel: HTMLElement} | Fires whenever the active tab changes. Includes the current index, tab and panel element |

Properties

| Name | Type | Description | | ------------ | --------------- | --------------------------------------------- | | .container | HTMLElement | Returns the container element | | .panels | HTMLElement[] | Returns an Array holding all panel elements | | .tabs | HTMLElement[] | Returns an Array holding all tabs elements |