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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pmeig/ngb-label

v1.0.0

Published

A powerful Angular library that provides Bootstrap-styled label components with advanced features like floating labels, smart input type detection, and checkbox/radio button styling.

Readme

@pmeig/ngb-label

A powerful Angular library that provides Bootstrap-styled label components with advanced features like floating labels, smart input type detection, and checkbox/radio button styling.

Installation

  npm install @pmeig/ngb-label

Features

  • 🎯 BLabelDirective - Smart label directive with automatic input type detection
  • 🏷️ BLabelFloatingDirective - Floating label functionality with positioning options
  • ☑️ BLabelCheckDirective - Checkbox and radio button label styling with switch support
  • 🔘 BLabelCheckButtonDirective - Button-styled checkbox/radio labels with color variants
  • Automatic Type Detection - Automatically applies correct Bootstrap classes based on input type
  • 🎨 Floating Labels - Bootstrap 5.3.3 floating label support with positioning
  • 🔄 Dynamic Positioning - Start/end label positioning with input group support
  • 🎨 Bootstrap 5.3.3 compatible styling
  • 🚀 Angular 20.2.1 support with signals
  • 📱 Responsive design
  • ♿ Accessibility friendly
  • 🛠️ Smart parent element management

Usage

Import the Module

import { LabelMaterial } from '@pmeig/ngb-label';

@NgModule({
imports: [
LabelMaterial
],
// ...
})
export class AppModule { }

Basic Label Usage

<!-- By default is floating labels -->
<input type="text" id="username" label="Username" class="form-control">

Label Positioning

<input type="text" id="floatingInput" class="form-control" label="Username" 
       placeholder="Username" floating="false">

<!-- Right label -->
<input type="text" id="rightLabel" class="form-control" label="Username" floating="false"
       placeholder="Username" label-position="end">

API Reference

BLabelDirective

Applied automatically to label[for] elements.

| Property | Type | Description | |----------|------|-------------| | for | Element | Target input element (can override HTML for attribute) |

BLabelFloatingDirective

Applied to inputs with label attribute (excludes checkboxes, radios, and ranges).

| Property | Type | Default | Description | |----------|------|---------|-------------| | floating | boolean | true | Enables floating label behavior | | label-position | 'start' \| 'end' | 'start' | Label position when not floating |

BLabelCheckDirective

Applied to checkbox/radio inputs with label attribute (excludes button-type).

| Property | Type | Default | Description | |----------|------|---------|-------------| | switch | boolean | false | Enables Bootstrap switch styling for checkboxes |

BLabelCheckButtonDirective

Applied to checkbox/radio inputs with label and label-type="btn".

| Property | Type | Default | Description | |----------|------|---------|-------------| | label-btn-outline | boolean | false | Uses outline button styling | | label-btn-color | ColorAttribute | undefined | Button color variant |

How It Works

Automatic Type Detection

The label directives automatically:

  1. Detect input types: Examines the associated input element's type
  2. Apply appropriate classes: Uses form-label for regular inputs, form-check-label for checkboxes/radios
  3. Handle click events: Properly associates labels with custom elements
  4. Manage parent containers: Creates and manages form floating/check containers

Floating Label Behavior

  • Default floating: Labels float above inputs when focused or filled
  • Position control: label-position controls placement when floating is disabled
  • Dynamic insertion: Labels are dynamically positioned in the DOM

Bootstrap Classes Support

This library generates and works with standard Bootstrap 5 form classes:

  • form-label - Standard form labels
  • form-check-label - Checkbox/radio labels
  • form-floating - Floating label containers
  • form-check - Checkbox/radio containers
  • form-switch - Switch-style checkboxes
  • btn, btn-* - Button-styled labels
  • btn-outline-* - Outline button variants
  • btn-check - Hidden button-check inputs

Dependencies

  • Angular: ^20.2.1
  • @angular/common: ^20.2.1
  • @pmeig/ngb-core: ^0.0.1
  • tslib: ^2.3.0

Compatibility

  • Angular: 20.2.1+
  • Bootstrap: 5.3.3+
  • TypeScript: 5.8.3+
  • Modern browsers (Chrome, Firefox, Safari, Edge)

Troubleshooting

Common Issues

Labels not showing correct styling

  • Ensure the for attribute matches the input's id
  • Verify input type detection is working correctly

Floating labels not working

  • Ensure placeholder text is provided for floating labels
  • Check that the input has the form-control class
  • Verify the parent container structure

Button labels not applying colors

  • Ensure label-type="btn" is set
  • Check color attribute values are valid Bootstrap colors
  • Verify button label directives are being applied

Checkbox/radio labels misaligned

  • Check parent container has proper Bootstrap form classes
  • Ensure switch functionality is properly configured
  • Verify checkbox/radio styling directives are active

License

This project is licensed under the MIT License.

Support

For issues and questions, please open an issue on the GitHub repository.