3.17.4 • Published 2 months ago

ngx-super-select v3.17.4

Weekly downloads
-
License
-
Repository
github
Last release
2 months ago

NgxSuperSelect

This is a single/multiple choice drop down for Angular with search and other features!


Live Demo on Stackblitz


Features

  • Multiple Selection Mode
  • Single Selection Mode With Custom Default Value!
  • Supports Primitive Data Types (number, string) And Complex Objects
  • Search
  • Select All | Invert Selection | Clear All
  • Angular Forms Support
  • Dark Theme And Light Theme Support

Build Status

BuildNPM Publish
Buildpublish-npm-package

Install

> npm i ngx-super-select

Add Imports

in the app.module.ts file import NgxSuperSelectModule like this:

  imports: [
    ...
    NgxSuperSelectModule
  ]

Usage

You can use it as simple as this:

 <ngx-super-select [dataSource]="[1,2,3]">
 </ngx-super-select>

to select options by default:

 <ngx-super-select [dataSource]="[1,2,3]" 
                   [selectedItemValues]="[2]">
 </ngx-super-select>

to disable options:

 <ngx-super-select [dataSource]="[1,2,3]" 
                   [selectedItemValues]="[2]"
                   [disabledItemValues]="[2, 3]">
 </ngx-super-select>

if you have complex object data then you need to set options:

in your component.ts file

data: { name: string }[] = [
    { name: 'hesam' },
    { name: 'kashefi' }
];

options: Partial<NgxSuperSelectOptions> = {
    actionsEnabled: true,
    displayExpr: 'name',
    valueExpr: 'name',
    placeholder: 'select',
    searchEnabled: true,
    enableDarkMode: false
}

in your component.html file:

<ngx-super-select [dataSource]="data"
                  [options]="options">

</ngx-super-select>

Use in a form:

data: { name: string }[] = [
    { name: 'hesam' },
    { name: 'kashefi' }
];

options: Partial<NgxSuperSelectOptions> = {
    actionsEnabled: true,
    displayExpr: 'name',
    valueExpr: 'name',
    placeholder: 'select',
    searchEnabled: true,
    enableDarkMode: false
}

form = new FormGroup({
  names: new FormControl([])
});

onFormSubmit() {
  console.log(this.form.value);
}
  <form [formGroup]="form"
        (submit)="onFormSubmit()">
    <ngx-super-select [dataSource]="data"
                      [options]="options"
                      formControlName="names">

    </ngx-super-select>
    <button type="submit"
            class="btn btn-primary my-2">Submit</button>
  </form>

Single Selection Mode:

Set selectionMode: 'single' in the options to enable single selection.

You can also use singleSelectionModeDefaultValue option to specify the empty value for no selection!

 <ngx-super-select formControlName="item"
                   [dataSource]="[1,2,3]"
                   [options]="{ selectionMode: 'single', singleSelectionModeDefaultValue: 0}">

  </ngx-super-select>
    
3.17.4

2 months ago

3.17.2

2 months ago

3.17.1

3 months ago

3.5.7

8 months ago

3.5.6

8 months ago

3.17.0

5 months ago

3.5.8

8 months ago

3.5.3

8 months ago

3.5.2

8 months ago

3.5.1

8 months ago

3.5.0

8 months ago

3.5.5

8 months ago

3.5.4

8 months ago

3.4.0

8 months ago

3.3.0

8 months ago

3.2.0

8 months ago

3.1.0

9 months ago

3.0.0

9 months ago

2.2.0

9 months ago

2.1.0

9 months ago

2.0.4

9 months ago

2.0.3

9 months ago

2.0.0

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

0.0.1

9 months ago