All Projects → manishjanky → Ngx Select Dropdown

manishjanky / Ngx Select Dropdown

Licence: mit
Custom Dropdown for Angular 4+ with multiple and single selection options

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Select Dropdown

Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+2956.04%)
Mutual labels:  select, dropdown, multiselect, angular4
Nb Choices
Angular wrapper for choices.js, vanilla, lightweight, configurable select box/text input plugin
Stars: ✭ 32 (-64.84%)
Mutual labels:  custom, select, dropdown, multiselect
Downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
Stars: ✭ 10,183 (+11090.11%)
Mutual labels:  select, dropdown, multiselect
Angular2 Multiselect Dropdown
Angular 2 Dropdown Multiselect
Stars: ✭ 225 (+147.25%)
Mutual labels:  select, dropdown, multiselect
Ngx Tree Select
Angular select component with tree items
Stars: ✭ 59 (-35.16%)
Mutual labels:  library, select, angular4
Multiselect
Vue 3 multiselect component with single select, multiselect and tagging options.
Stars: ✭ 92 (+1.1%)
Mutual labels:  select, dropdown, multiselect
React Multi Select
A Multi Select component built with and for React
Stars: ✭ 111 (+21.98%)
Mutual labels:  component, select, multiselect
React Select Search
⚡️ Lightweight select component for React
Stars: ✭ 379 (+316.48%)
Mutual labels:  component, select, dropdown
react-multi-select-component
Lightweight (~5KB gzipped) multiple selection dropdown component
Stars: ✭ 279 (+206.59%)
Mutual labels:  select, multiselect, dropdown
Vue Treeselect
A multi-select component with nested options support for Vue.js
Stars: ✭ 2,347 (+2479.12%)
Mutual labels:  component, select, dropdown
Vue Multiselect
Universal select/multiselect/tagging component for Vue.js
Stars: ✭ 5,988 (+6480.22%)
Mutual labels:  component, select, dropdown
Ngx Ui
🚀 Style and Component Library for Angular
Stars: ✭ 534 (+486.81%)
Mutual labels:  library, component, select
Stf Vue Select
stf vue select - most flexible and customized select
Stars: ✭ 61 (-32.97%)
Mutual labels:  custom, component, select
Angular Tree Component
A simple yet powerful tree component for Angular (>=2)
Stars: ✭ 1,031 (+1032.97%)
Mutual labels:  library, angular4
Hellobooks
A Single-Page Library Management App built with nodejs, express and react and redux
Stars: ✭ 37 (-59.34%)
Mutual labels:  library, component
Pannellum React
React Component for Pannellum (open source panorama viewer for the web)
Stars: ✭ 48 (-47.25%)
Mutual labels:  library, component
Ngautocomplete
Light-weight autocomplete component for Angular.
Stars: ✭ 52 (-42.86%)
Mutual labels:  dropdown, angular4
Hhcustomcorner
Awesome library to customize corners of UIView and UIButton. Now you can customize each corner differently
Stars: ✭ 36 (-60.44%)
Mutual labels:  library, custom
Faboptions
A multi-functional FAB component with customizable options
Stars: ✭ 1,060 (+1064.84%)
Mutual labels:  library, component
React Native Modal Dropdown
A react-native dropdown/picker/selector component for both Android & iOS.
Stars: ✭ 1,103 (+1112.09%)
Mutual labels:  select, dropdown

ngx-select-dropdown

GitHub license npm Build Status Codecov branch npm GitHub top language GitHub code size in bytes

ngx-select-dropdown Custom Dropdown component for Angular 4+ with multiple and single selection options

Features

  • single select dropdown
  • multi select dropdown
  • search dropdown list
  • arrows keys support
  • limit number of items displayed in dropdown
  • custom sort
  • angular forms support
  • angular v4 and above supported
  • cross browser support

Examples

Installation

  • npm install ngx-select-dropdown

Using with webpack and tsc builds/ angular-cli builds

  • import SelectDropDownModule into your app.module;
import { SelectDropDownModule } from 'ngx-select-dropdown'
  • add SelectDropDownModule to the imports of your NgModule:
@NgModule({
  imports: [
    ...,
    SelectDropDownModule
  ],
  ...
})
class YourModule { ... }
  • include css styles in you angular-cli.json for versions earlier than 1.4.0
 "styles": [
        "../node_modules/ngx-select-dropdown/dist/assets/style.css"
      ],
  • use <ngx-select-dropdown></ngx-select-dropdown> in your templates to add the custom dropdown in your view like below
<ngx-select-dropdown (change)="selectionChanged($event)" [multiple]="true" [(ngModel)]="dataModel" [config]="config" [options]="dropdownOptions"></ngx-select-dropdown>
  • use with reactive form like
<ngx-select-dropdown (change)="selectionChanged($event)" formControlName="selectData" [multiple]="true" [config]="config" [options]="dropdownOptions"></ngx-select-dropdown>

Config

Input

  • multiple: boolean - true/false beased if multiple selection required or not Defaults to false.
  • options: Array - Array of string/objects that are to be the dropdown options.
  • disabled: boolean - disabled attribute to disable the dropdown when required.
  • config: Object - configuration object.
config = {
        displayFn:(item: any) => { return item.hello.world; } //to support flexible text displaying for each item
        displayKey:"description", //if objects array passed which key to be displayed defaults to description
        search:true //true/false for the search functionlity defaults to false,
        height: 'auto' //height of the list so that if there are more no of items it can show a scroll defaults to auto. With auto height scroll will never appear
        placeholder:'Select' // text to be displayed when no item is selected defaults to Select,
        customComparator: ()=>{} // a custom function using which user wants to sort the items. default is undefined and Array.sort() will be used in that case,
        limitTo: 0 // number thats limits the no of options displayed in the UI (if zero, options will not be limited)
        moreText: 'more' // text to be displayed whenmore than one items are selected like Option 1 + 5 more
        noResultsFound: 'No results found!' // text to be displayed when no items are found while searching
        searchPlaceholder:'Search' // label thats displayed in search input,
        searchOnKey: 'name' // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys
        clearOnSelection: false // clears search criteria when an option is selected if set to true, default is false
        inputDirection: 'ltr' // the direction of the search input can be rtl or ltr(default)
      }

Output

  • change: Event - change event when user changes the selected options
  • open: Event - open event when the dropdown toogles on
  • close: Event - close event when the dropdown toogles off
  • searchChange: Event - search change event when the search text changes

Change detection

As of now ngx-select-dropdown uses Default change detection startegy which means dirty checking checks for immutable data types. And in Javascript Objects and arrays are mutable. So when changing any of the @Input parameters if you mutate an object change detection will not detect it. For ex:-

this.options.push({id: 34, description: 'Adding new item'});

// or

config.height = '200px';

Both the above scenarios will not trigger the change detection. In order for the componet to detect the changes what you need to do is:-

this.options = [...this.options, {id: 34, description: 'Adding new item'}];

// or

config = {...config, height:'200px'};

Changelog

  • v0.1.0
 Added a change event so that user can attach a change event handler.
 If multiselect the selected text will display first item and + count for eg. (Option 1 + 2 more) .
  • v0.2.0
 Angular 4 and above support.
 Bug with search functionality fixed.
  • v0.3.0
 Support for Observable data source for options and async pipe.
 IE bug with styling.
 Few other minor bug fixes.
  • v0.4.0
 Use arrows keys and enter to select items from available options.
 Case insensitive search.
 Few other minor bug fixes.
  • v0.5.0
 Support for scroll bar with too many list items.
 Few other minor bug fixes.
  • v0.7.0
 Support for limito pipe to limit number of options displayed in case of too many options.
 Support for customComparator / custom sort function
 Few other minor bug fixes.
  • v0.7.2
 Support for angular 6
 Removed dependency on rxjs
  • v0.8.0
 No Results found indicator with custom text passed with config
 Custom text for *more* when more than 1 items selected
 Open event emitted
 Close event emitted
 Search placeholder text
  • v1.0.0
 Search on a specified key value.
 Support for Reactive forms
 Few other minor imoprovements and fixes
  • v1.2.0
 Search text change event searchChange
  • v1.3.0
 Clear search on selection config
 Disable with reactive forms .disable()
  • v1.5.0
Custom function for displaying text for each option
Add disabled class to different items based on item.disabled

Help Improve

Found a bug or an issue with this? Open a new issue here on GitHub.

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].