Angular Icon Picker
- ==> Library still in work in progress
- Largely inspired by ngx-color-picker
Angular IconPicker Directive/Component with no dependencies required.
This is an Icon Picker Directive/Component for Angular 2+.
Installing and usage
npm install ngx-icon-picker --save
Or with yarn :
yarn add ngx-icon-picker
Load the module for your app:
;
Use it in your HTML template:
Available inputs and output :
// The icon to select in the grid. // Use this option to set icon picker dialog width (default: '230px'). // Use this option to force icon picker dialog height (default: 'auto'). // Use this option to force icon picker dialog max-height (default: '200px'). // Icon pack (Font Awesome / Bootstrap Glyphicon): 'fa', 'bs', 'all' (default: 'all'). // Is used when the icon is undefined (default: 'fas fa-user-plus'). // Dialog position: 'right', 'left', 'top', 'bottom' (default: 'right'). // Search input placeholder (default: 'Search icon...'). iconPickerSelect // On selected icon value.
Installing from a brand new @angular/cli project
Version of @angular/cli used is V1.2.0.
- Generate a new project (here we use LESS preprocessor) :
ng new myproject --style less
cd myproject
- Update package.json with :
or with npm command :"bootstrap": "3.3.7", "font-awesome": "4.7.0", "ngx-icon-picker": "0.0.8",
npm install --save bootstrap@3.3.7 npm install --save font-awesome@4.7.0 npm install --save ngx-icon-picker@0.0.8
- Install dependancies :
yarn install
(ornpm install
). - Update styles.less with :
'~bootstrap/less/bootstrap.less'; '~font-awesome/less/font-awesome.less';
- Import IconPickerModule in
app.module.ts
(also CommonModule and ReactiveFormsModule):
;; ;;;;
- Update the template
app.component.html
:
Icon
- Update the component
app.component.ts
:
;;
- Start your project with
yarn start
(ornpm start
) and go to localhost:4200
- You should now be able to change icon by clicking input field :
Build the library
npm installnpm run buildnpm run inline
Library development
npm linkcd examplenpm link ngx-icon-picker
Running the example
cd examplenpm installnpm start
go to localhost:4200