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

@ng-zi/extensions-badge

v0.0.1

Published

Angular Material Extensions for badge

Downloads

1

Readme

MtxBadge Component Overview

The MtxBadge Component is a customizable badge component built using Angular Material. It enhances the standard Angular Material badge with additional features and flexibility.

Installation

Importing the Module

Import MtxBadgeModule in your Angular module:

import { NgModule } from '@angular/core';
import { MtxBadgeModule } from '@ng-zi/extensions/badge';

@NgModule({
  imports: [
    // other imports
    MtxBadgeModule
  ]
})
export class AppModule { }

Using the Component

Use the mtx-badge component in your templates:

<mtx-badge [config]="badgeConfig">
  <button>Notifications</button>
</mtx-badge>

Configuration

The config input property allows customization of the badge:

badgeConfig = {
  text: 'New',
  icon: 'notifications',
  tooltip: 'New notifications',
  color: 'accent',
  size: 'small',
  position: 'below before',
  hidden: false,
  customClasses: ['custom-class'],
  clickable: true,
  animation: 'slide'
};

Properties

| Property | Type | Default | Description | |----------------|---------------------------|------------|------------------------------------------------------------------| | text | string | '' | The text to display in the badge. | | icon | string | '' | The icon to display in the badge (uses Angular Material icons). | | tooltip | string | '' | The tooltip text to display when hovering over the badge. | | color | ThemePalette | primary | The color of the badge. Can be primary, accent, or warn. | | size | MatBadgeSize | medium | The size of the badge. Can be small, medium, or large. | | position | MatBadgePosition | above after | The position of the badge. Can be above or below, combined with before or after. | | hidden | boolean | false | Whether the badge is hidden. | | customClasses| string[] | [] | Custom CSS classes to apply to the badge. | | clickable | boolean | false | Whether the badge is clickable. | | animation | 'fade' | 'slide' | fade | The animation type for visibility changes. |

Events

| Event | Description | |---------------|------------------------------------------------------| | badgeClick | Emitted when the badge is clicked (if clickable is true). |

Examples

Basic Usage

<mtx-badge [config]="{ text: 'New', color: 'accent' }">
  <button mtx-button>Messages</button>
</mtx-badge>

Advanced Usage

<mtx-badge
  [config]="{
    text: '99+',
    icon: 'notifications',
    tooltip: '99+ notifications',
    color: 'warn',
    size: 'large',
    position: 'below after',
    hidden: false,
    customClasses: ['custom-badge'],
    clickable: true,
    animation: 'slide'
  }"
  (badgeClick)="handleBadgeClick()"
>
  <div>Inbox</div>
</mtx-badge>