ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - zefoy/ngx-font-picker: Google fonts font picker widget for Angular (version 2 and newer)
Google fonts font picker widget for Angular (version 2 and newer) - zefoy/ngx-font-picker
Visit Site

GitHub - zefoy/ngx-font-picker: Google fonts font picker widget for Angular (version 2 and newer)

GitHub - zefoy/ngx-font-picker: Google fonts font picker widget for Angular (version 2 and newer)

Angular Font Picker

This is a simple font picker loosely based on the cool angular2-color-picker by Alberplz.

This documentation is for the latest 5/6.x.x version which requires Angular 5 or newer. For Angular 4 you need to use the latest 4.x.x version. Documentation for the 4.x.x can be found from here.

Quick links

Example application | StackBlitz example

Building the library

npm install
npm run build

Running the example

npm install
npm run start

Installing and usage

npm install ngx-font-picker --save
Load the module for your app (with global configuration):

Global configuration should be provided only once (this is usually done in the root module).

import { FontPickerModule } from 'ngx-font-picker';
import { FONT_PICKER_CONFIG } from 'ngx-font-picker';
import { FontPickerConfigInterface } from 'ngx-font-picker';

const DEFAULT_FONT_PICKER_CONFIG: FontPickerConfigInterface = {
  // Change this to your Google API key
  apiKey: 'AIzaSyA9S7DY0khhn9JYcfyRWb1F6Rd2rwtF_mA'
};

@NgModule({
  ...
  imports: [
    ...
    FontPickerModule
  ],
  providers: [
    {
      provide: FONT_PICKER_CONFIG,
      useValue: DEFAULT_FONT_PICKER_CONFIG
    }
  ]
})
Use it in your HTML template (for example in div element):
<div #fontPickerElement=ngxFontPicker [(fontPicker)]="font" [fpWidth]="'320px'" [fpPosition]="'bottom'">
  Click to open the font picker
</div>
[(fontPicker)]               // Selected font ({family, size, style, styles, files}).

[fpWidth]                    // Width of the font picker (Default: '280px').
[fpHeight]                   // Height of the font picker (Default: '320px').

[fpPosition]                 // Position of the font picker (Default: 'bottom').

[fpAutoLoad]                 // Auto loads font on change (fontPicker input change).

[fpSearchText]               // Search hint text (Default: 'Search fonts...').
[fpLoadingText]              // Fonts loading text (Default: 'Loading fonts...').

[fpPopularLabel]             // Popular fonts label (Default: 'Popular fonts').
[fpResultsLabel]             // Search results label (Default: 'Search results').

[fpSizeSelect]               // Show size selector in the font picker (Default: false).
[fpStyleSelect]              // Show style selector in the font picker (Default: false).

[fpPresetLabel]              // Label for the preset fonts list (Default: undefined).
[fpPresetFonts]              // Listing of preset fonts to show (Default: undefined).
[fpPresetNotice]             // Notice to show for custom fonts (Default: undefined).

[fpFallbackFont]             // Fallback font (Default: {family: 'Roboto', size: 14}).

[fpCancelButton]             // Show cancel button in the font picker (Default: false).
[fpCancelButtonText]         // Text label for the cancel button (Default: 'Cancel').
[fpCancelButtonClass]        // Class name for the cancel button (Replaces default).

[fpUploadButton]             // Show upload button in the font picker (Default: false).
[fbUploadButtonText]         // Text label for the upload button (Default: 'Upload').
[fpUploadButtonClass]        // Class name for the upload button (Replaces default).

[fpDialogDisplay]            // Dialog positioning mode: 'popup', 'inline' ('popup').
                             //   popup: dialog is shown as popup (fixed positioning).
                             //   inline: dialog is shown permanently (static positioning).

[fpUseRootViewContainer]     // Create dialog component in the root view container (false).
                             // Note: The root component needs to have public viewContainerRef.

[fpFilterByFamilies]         // Provides a list of font families that are allowed to be used (Default: [])
[fpSortByFamilies]           // Sort fonts by family (Default: false)

(fontPickerChange)           // Event handler for the font / size / style change.

(fontPickerUpload)           // Event handler for the font upload button click event.
Available configuration options (for the global configuration):
apiKey                       // Your Google API key for the Google Web Fonts API.
Available control / helper functions (provided by the service):
loadFont(font)               // Loads the given font (family:style) from Web Fonts.

getAllFonts(sort)            // Returns list of Google Fonts with given sort option:
                             // 'alpha' | 'date' | 'popularity' | 'style' | 'trending'
Available control / helper functions (provided by the directive):
loadFont(font)               // Loads the (font.family:font.style) form Web Fonts.

openDialog()                 // Opens the font picker dialog if not already open.
closeDialog()                // Closes the font picker dialog if not already closed.

toggleDialog()               // Toggles the open state of the font picker dialog.
Accessing the Font Picker directive by using a ViewChild reference:
@ViewChild('fontPickerElement', {static: true})
fontPicker: FontPickerDirective;
  
closeFontPicker(field: string): void {
  this.fontPicker.closeDialog();
}  

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory