Member Junction
    Preparing search index...

    mj-icon-picker — choose a Font Awesome icon by looking at it.

    Typing a class name is not something to ask of a user: the name has to be remembered exactly, and Font Awesome needs a style class beside it — fa-chart-column on its own renders nothing at all, which looks like a bug rather than a missing word. This searches the icons the page has actually loaded and writes a complete class string.

    The text box stays, because a user who knows the name is faster typing it, and because a value from elsewhere must remain editable. What it emits is normalized either way.

    The grid opens in an overlay rather than inside the field. Anchored in the field it sat in whatever scrolling box the host had, widened that box and left the surrounding panel scrolling sideways — a picker must not resize the form it is part of.

    <mj-icon-picker [(ngModel)]="Icon" Placeholder="Search icons"></mj-icon-picker>
    

    Implements

    • ControlValueAccessor
    Index

    Constructors

    Properties

    AriaLabel: string = 'Icon'

    Accessible name for the text box, when no visible label sits beside it.

    Disabled: boolean = false

    Disables both the box and the browse button.

    GridWidth: 320 = MjIconPickerComponent.GRID_WIDTH
    IsLoading: boolean = false

    True while the icon fonts are being fetched so their glyphs can be measured.

    IsOpen: boolean = false

    Whether the icon grid is open.

    Placeholder: string = 'Search icons, or type a class'
    Positions: ConnectedPosition[] = ...

    Below the field, or above it when there is no room.

    Style: string = DEFAULT_ICON_STYLE

    The style given to a name typed by hand, when it names none itself.

    Text: string = ''

    What is in the text box, which may not yet be a complete class string.

    ValueChange: EventEmitter<string> = ...
    GRID_WIDTH: 320

    Width the overlay opens at, so the grid is usable beside a narrow field.

    Accessors

    Methods

    • Parameters

      • fn: (value: string) => void

        The callback function to register

      Returns void

      Registers a callback function that is called when the control's value changes in the UI.

      This method is called by the forms API on initialization to update the form model when values propagate from the view to the model.

      When implementing the registerOnChange method in your own value accessor, save the given function so your class calls it at the appropriate time.

      The following example stores the provided function as an internal method.

      registerOnChange(fn: (_: any) => void): void {
      this._onChange = fn;
      }

      When the value changes in the UI, call the registered function to allow the forms API to update itself:

      host: {
      '(change)': '_onChange($event.target.value)'
      }
    • Parameters

      • fn: () => void

        The callback function to register

      Returns void

      Registers a callback function that is called by the forms API on initialization to update the form model on blur.

      When implementing registerOnTouched in your own value accessor, save the given function so your class calls it when the control should be considered blurred or "touched".

      The following example stores the provided function as an internal method.

      registerOnTouched(fn: any): void {
      this._onTouched = fn;
      }

      On blur (or equivalent), your class should call the registered function to allow the forms API to update itself:

      host: {
      '(blur)': '_onTouched()'
      }
    • Parameters

      • disabled: boolean

      Returns void

      Function that is called by the forms API when the control status changes to or from 'DISABLED'. Depending on the status, it enables or disables the appropriate DOM element.

      The following is an example of writing the disabled property to a native DOM element:

      setDisabledState(isDisabled: boolean): void {
      this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
      }
    • Parameters

      • value: string | null

      Returns void

      Writes a new value to the element.

      This method is called by the forms API to write to the view when programmatic changes from model to view are requested.

      The following example writes a value to the native DOM element.

      writeValue(value: any): void {
      this._renderer.setProperty(this._elementRef.nativeElement, 'value', value);
      }