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 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-select-dropdown

v0.0.4

Published

A highly customizable and flexible dropdown select component for Angular applications. Ideal for creating dynamic select menus with search, filtering.

Readme

Angular Select Dropdown Component

A flexible and customizable dropdown component for Angular that allows users to select from a list of items. It supports features like sorting, clearing selections, and customizable item labels.

Features

  • Customizable Label Handler: Use a function to define how to extract the label for each item.
  • Sort Items: Sort items based on a specified key.
  • Clearable: Allows clearing the selection with an optional clear button.
  • Disabled State: Disable the dropdown and prevent interaction.
  • Dynamic Search: Shows a message when no items match the search query.
  • Close on Clear: Close the dropdown when the selection is cleared (optional).
  • Placeholder: Display a placeholder text when no item is selected.

Installation

You can install the component via npm:

npm install angular-select-dropdown --save

Usage

To use the AngularSelectDropdownComponent in your Angular project:

  1. Import the module in your Angular module:
import { AngularSelectDropdownModule } from 'angular-select-dropdown';

@NgModule({
  imports: [
    AngularSelectDropdownModule
  ]
})
export class AppModule {}

Inputs

  • labelHandler: (item: T) => any: A function that extracts the label for each item. Default is (item) => item.name || item is used, which tries to get name from the item or returns the item itself if name is missing.
  • sortKeyName: string: The key used to sort the items. Default is 'value'.
  • items: T[]: An array of items to populate the dropdown.
  • isClearable: boolean: If true, shows a clear button to remove the selected item. Default is false.
  • disabled: boolean: If true, the dropdown is disabled. Default is false.
  • closeMenuOnClear: boolean: If true, the dropdown menu will close when the selection is cleared. Default is true.
  • placeholder: string: The placeholder text when no item is selected. Default is an empty string.
  • notFoundMessage: string: The message to display when no items match the search. Default is 'Nothing found'.

Outputs

  • selectItem: EventEmitter<T>: Emits the selected item when an item is selected.

Use the component in your template:

<angular-select-dropdown
  [items]="items"
  [labelHandler]="labelHandler"
  [sortKeyName]="'value'"
  [isClearable]="true"
  [disabled]="false"
  [placeholder]="'Select an item'"
  [closeMenuOnClear]="true"
  [formControl]="control"
  (selectItem)="onSelectItem($event)">
</angular-select-dropdown>

Example Component

import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';

@Component({
  selector: 'app-dropdown-example',
  templateUrl: './dropdown-example.component.html'
})
export class DropdownExampleComponent {
  items = [
    { value: 1, name: 'Item 1' },
    { value: 2, name: 'Item 2' },
    { value: 3, name: 'Item 3' }
  ];
  // or simple string
  items = [ 'item 1', 'item 2', 'item 3' ];

  labelHandler = (item) => item[yourKey];
  control: FormControl = new FormControl();

  onSelectItem(selectedItem) {
    console.log('Selected Item:', selectedItem);
  }
}

Styling

You can apply custom styles to the dropdown by targeting the angular-select-dropdown class in your global styles.

.angular-select-dropdown {
  /* Custom styles for the dropdown */
}

License

This component is open-source and available under the MIT license.

Contributing

Feel free to fork the repository and submit pull requests for any improvements or bug fixes.