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

@tailwindash/triangle

v1.0.5

Published

Tailwind plugin to build triangle with border attributes

Downloads

57

Readme

@tailwindash/triangle

npm.badge bundlephobia.badge Tailwind Play

Tailwind plugin for building triangles with border attributes.

Showcase

Table of Contents

tailwindash

This package is part of the @tailwindash family. For contributing guideline and more, refer to its readme.

Installation

  1. Make sure you have tailwind setup for your project.

  2. Install @tailwindash/triangle

    npm install -D @tailwindash/triangle
    pnpm add -D @tailwindash/triangle
    yarn add -D @tailwindash/triangle
  3. Add plugin to tailwind config file

    /** @type {import("tailwindcss").Config } */
    const config = {
      plugins: [require('@tailwindash/triangle')],
    };
    
    module.exports = config;

Quick Start

See Tailwind Play. For more customization, see below Documentation.

Documentation

Direction Abbreviation

| Direction | Abbreviation | | ------------ | ------------ | | top | t | | bottom | b | | left | l | | right | r | | top left | tl | | top right | tr | | bottom left | bl | | bottom right | br |

Class Names

| Class name | Values | Type | Group | Required | Description | | ---------------- | ------------------------------------------------------------ | --------- | --------- | -------- | ------------------------------- | | triangle | | component | | yes | base class | | triangle-... | one of {t, b, l, r, tl, tr, bl, br } | utility | direction | yes | placement direction | | triangle-... | as in tailwind's color | utility | color | no | color | | triangle-... | integer from 1 to 10, or as customized | utility | scale | no | see Scaling | | triangle-w-... | as in tailwind's width | utility | size | no | width | | triangle-h-... | as in tailwind's height | utility | size | no | height |

Sizing & Scaling

Depending on the direction, triangle will have the following default width & height

| Direction | Width | Height | | ------------------------ | -------- | -------- | | triangle-{t,b} | 1rem | 0.5rem | | triangle-{l,r} | 0.5rem | 1rem | | triangle-{tl,tr,bl,br} | 1rem | 1rem |

⚠️ Scaling is done by applying css's calc() to width and height, not transform: scale(...)

For example:

<div class="triangle triangle-t triangle-w-5 triangle-h-10 triangle-3"></div>
<!-- The calculation below assumes tailwind's default config -->
<!-- w-5 = 1.25rem -->
<!-- h-10 = 2.5rem -->
<!-- scaling factor = 3 -->
<!-- => triangle width = 1.25rem * 3 -->
<!-- => triangle height = 2.5rem * 3 -->

Below is the default support for scaling. Extend triangle if customization is needed (see Customization).

/** @type {import("tailwindcss").Config } */
const config = {
  theme: {
    triangle: {
      1: '1',
      2: '2',
      3: '3',
      4: '4',
      5: '5',
      6: '6',
      7: '7',
      8: '8',
      9: '9',
      10: '10',
    },
  },
};

Customization

This plugin respects your tailwind config, including prefixes.

For customization of the scaling factor, set or extend the triangle object. Make sure to have a valid factor for css's calc().

/** @type {import("tailwindcss").Config } */
const config = {
  theme: {
    extend: {
      triangle: {
        '1/2': '1/2',
        20: '20',
      },
    },
  },
  plugins: [require('@tailwindash/triangle')],
};

module.exports = config;

Changelog