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

super-simple-ui-components

v2.0.1

Published

A ridiculously simple, tree shakeable, dependency free, vanilla javascript UI component package. Components include: Accordion, Popup, Tabs, Toast, and Tooltip.

Downloads

9

Readme

npm bundle size npm NPM

Super Simple UI Components

A ridiculously simple, tree shakeable, dependency free, vanilla javascript UI component package, that is also ARIA compliant. Components include: Accordion, Popup, Tabs, Toast, and Tooltip.

Getting Started

Install using a package manager

Install the package as a dependency in your project.

npm install super-simple-ui-components

In your Javascript file import the css and any components you will need from the package.

import 'super-simple-ui-components/lib/bundle.min.css';
import { Accordion } from 'super-simple-ui-components';

const accordion = new Accordion('#accordion');
accordion.init();

Install using <script> tag / CDN

To use the package in the browser via script tag, you can download the minified script through GitHub or use the CDN.

<!-- In your project <head> -->
<link href="https://unpkg.com/[email protected]/lib/bundle.min.css" rel="stylesheet" />
<script src="https://unpkg.com/[email protected]/lib/bundle.umd.min.js"></script>

<!-- In your Javascript -->
<script>
  const { Accordion } = sui;
  const accordion = new Accordion('#accordion');
  accordion.init();
</script>

Documentation

The library is minimally styled and limited in options. Below is the required HTML markup and Javascript needed to use each component. To alter the appearance, override the CSS with your own classes.

Accordion

Markup

A wrapper ID is required for the constructor. For every tab/panel combination you need a tab and panel class.

<div id="accordion">
  <div class="tab">Tab 1</div>
  <div class="panel">Tab 1 Content</div>
  <div class="tab">Tab 2</div>
  <div class="panel">Tab 2 Content</div>
  <div class="tab">Tab 3</div>
  <div class="panel">Tab 3 Content</div>
</div>
const accordion = new Accordion('#accordion');
accordion.init();

See it in action on Codesandbox.

Popup

Markup

The popup-wrapper and popup HTML markup and IDs are required. Popup is displayed and hidden with calls to popup.show() and popup.hide() in your code.

<div id="popup-wrapper">
  <div id="popup">
    <button type="button" onclick="popup.hide()" id="popup-close">hide popup</button>
    <div>popup content</div>
  </div>
</div>
<button type="button" onclick="popup.show()">show popup</button>

Javascript

The available options:

const options = {
  maxWidth: '600px',
  opacity: '0.85',
};

const popup = new Popup((options = {})); // empty options object is required
popup.init();

See it in action on Codesandbox.

Toast

Markup

Toast is programatically displayed by calling toast.show() in your code.

<button onclick="toast.show()">Show toast</button>

Javascript

Options for position include: top center, top left, top right, and bottom center, bottom left, bottom right. The available options for style are: alert, success, warn and info.

const message = 'Download Simple UI Kit as package on NPM!';

const options = {
  style: 'success',
  position: 'top center',
  timeout: 4000,
};

const toast = new Toast(message, options);
toast.init();

See it in action on Codesandbox.

Tooltip

Markup

The tooltip class and data-message attribute are required.

<span class="tooltip" data-message="This is a tooltip!">What's a tooltip?</span>

Javascript

There is only one option for the tooltip and that is position. Values for position include: top, bottom, left and right.

const tooltip = new Tooltip('.tooltip', 'right');
tooltip.init();

See it action on Codesandbox

Tabs

Markup

A wrapper ID is required for the constructor. You must wrap your tabs and panels in a div with the classes tabs and panels respectively.

<div id="tabs">
  <div class="tabs">
    <div>Tab 1</div>
    <div>Tab 3</div>
    <div>Tab 2</div>
  </div>
  <div class="panels">
    <div>Tab 1 Content</div>
    <div>Tab 2 Content</div>
    <div>Tab 3 Content</div>
  </div>
</div>

Javascript

const tabs = new Tabs('#tabs');
tabs.init();

See it in action on Codesandbox.