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

simple-tabs-js

v1.4.1

Published

A quick way to implement tabs in your web project !!!

Downloads

25

Readme

simple-tabs-js

Uma maneira rapida de implementar tabs em seu projeto web!!! Demo Page (Em desenvolvimento)

  1. Instalação
  2. Importação
  3. Uso

Instalação

Usando o NPM, instale e salve-o em seu package.json.

$ npm install simple-tabs-js

Importação

  • ES6 Importe os arquivos necessarios.
// importe simple-tabs-js no main.js ou como precisar

import SimpleTabs from 'path/to/simple-tabs-js'
// importe simple-tabs-js no main.scss ou como precisar
@include 'path/to/simple-tabs-js/dist/bundle';
 <link rel="stylesheet" href="bundle.css">
 <script src="simpletabsjs.min.js"></script>

Uso

1 - Marcação HTML

A unica coisa que o simple-tabs necessita é uma estrutura HTML (exemplificada abaixo).

  • Por questão de semântica, a estrutura usa uma lista podendo ser ordenada ou não, contendo dentro de casa item uma âncora para navegação das tab.
  • Cada link deverá tem um href apontando para uma div através do id, como mostrado no exemplo.
  • "tab-default" será a primeira tab mostrada quando a pagina carregar, você podendo escolher qualquer uma da lista.
<div minha-tab-fantastica> // aqui, esse atributo, podera ser da sua escolha, sendo usado posteriormente
  <ol tab-list>
    <li tab tab-default><a href="#eenie">Eenie</a></li>
    <li tab><a href="#meenie">Meenie</a></li>
    <li tab><a href="#miney">Miney</a></li>
    <li tab><a href="#mo">Mo</a></li>
  </ol>
  <div content-list>
    <div id="eenie">Eenie</div>
    <div id="meenie">Meenie</div>
    <div id="miney">Miney</div>
    <div id="mo">Mo</div>
  </div>
</div>

2 - Inicialize o simpls-tabs

Em seu arquivo JS, inicialize o simple-tabs passando o atributo definido anteriormente.

const minhaTabFantastica = new SimpleTabs('[minha-tab-fantastica]') 

3 - Opções

Você pode passar um Objeto de configurações para alterar o estilo e comportamento padrão. Abaixo verá a configuração padrão.

const minhaTabFantastica = new SimpleTabs('[minha-tab-fantastica]', {
  preSet: 'default',
  minHeight: false,
  customHeight: '',
}) 
  • preSet é o estilo pre-definido, estando abaixo a lista com as opções atualmente disponiveis:

    • default // Somente o CSS necesário para o funcionamento.
    • 1 // Tabs Verticais.
    • purple-rain // Horizontal com tema roxo
    • green-lantern// Vertical com tema verde
  • minHeight é um "minHeight" colocado para nao interfeir ou "quebrar" seu projeto, sendo o tamanho da maior DIV dentro da estrutua, seu valor é Boleano.

  • customHeight como o nome ja diz, é um valor customizavel de altura da estrutura, por padrão ele é vazio, precisando caso use, passar em String o valor e a medida, Exemplo: customHeight: '100px'.

4 - Personalização (Divirta-se !!!)

Você pode adicionar classes a vontade na estrutura, apenas tomando cuidado para nao sobrescrever regras essenciais para o funcionamento, mas para isso será meio dificil.

<div minha-tab-fantastica>
  <ol tab-list>
    <li class="minha-tab" tab tab-default><a class="meu-link" href="#eenie"></a></li>
    <li class="minha-tab" tab><a class="meu-link" href="#meenie"></a></li>
    <li class="minha-tab" tab><a class="meu-link" href="#miney"></a></li>
    <li class="minha-tab" tab><a class="meu-link" href="#mo"></a></li>
  </ol>
  <div content-list>
    <div class="minha-div" id="eenie">Eenie</div>
    <div class="minha-div" id="meenie">Meenie</div>
    <div class="minha-div" id="miney">Miney</div>
    <div class="minha-div" id="mo">Mo</div>
  </div>
</div>

Licença

MIT. © 2019 Leandro C. Silva

forthebadge forthebadge