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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-font-picker-filtered-filtered

v13.0.2

Published

Google fonts font picker widget for Angular

Downloads

52

Readme

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.

(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();
}