Search results

FabComponent API in Angular Floating Action Button API component

Represents the Angular Fab Component.

<button ejs-fab content='fab'></button>

Properties

content

string

Defines the text content of the Button element.

    <button ejs-button [content]="content_normal">Normal</button>
import { Component, ViewEncapsulation } from "@angular/core";
import { ButtonComponent } from "@syncfusion/ej2-angular-buttons";
/**
 * Default Button Controller
 */
@Component({
  selector: "app-root",
  templateUrl: "app.component.html",
  styleUrls: ["app.component.css"],
  encapsulation: ViewEncapsulation.None
})
export class AppComponent {
  public content_normal = "Normal";

  constructor() {}
}

Defaults to ""

cssClass

string

Defines class/multiple classes separated by a space in the Button element. The Button types, styles, and size can be defined by using this.

    <button ejs-button [cssClass]="flat_class" isPrimary="true">Flat</button>
    import { Component, ViewEncapsulation } from "@angular/core";
    import { ButtonComponent } from "@syncfusion/ej2-angular-buttons";
    /**
    * Default Button Controller
    */
    @Component({
        selector: "app-root",
        templateUrl: "app.component.html",
        styleUrls: ["app.component.css"],
        encapsulation: ViewEncapsulation.None
    })
    export class AppComponent {
    public flat_class = "e-flat";

    constructor() {}
    }

Defaults to ""

disabled

boolean

Specifies a value that indicates whether the Button is disabled or not.

Defaults to false.

enableHtmlSanitizer

boolean

Defines whether to allow the cross-scripting site or not.

Defaults to false

enablePersistence

boolean

Enable or disable persisting component’s state between page reloads.

Defaults to false

enableRtl

boolean

Enable or disable rendering component in right to left direction.

Defaults to false

iconCss

string

Defines class/multiple classes separated by a space for the Button that is used to include an icon. Buttons can also include font icon and sprite image.

Defaults to ""

iconPosition

string | IconPosition

Positions the icon before/after the text content in the Button. The possible values are:

  • Left: The icon will be positioned to the left of the text content.
  • Right: The icon will be positioned to the right of the text content.

Defaults to IconPosition.Left

isPrimary

boolean

Defines whether to apply primary style for FAB.

Defaults to true

isToggle

boolean

Makes the Button toggle, when set to true. When you click it, the state changes from normal to active.

Defaults to false

position

string | FabPosition

Defines the position of the FAB relative to target. The possible values are:

  • TopLeft: Positions the FAB at the target’s top left corner.
  • TopCenter: Positions the FAB at the target’s top left corner.
  • TopRight: Positions the FAB at the target’s top left corner.
  • MiddleLeft: Positions the FAB at the target’s top left corner.
  • MiddleCenter: Positions the FAB at the target’s top left corner.
  • MiddleRight: Positions the FAB at the target’s top left corner.
  • BottomLeft: Positions the FAB at the target’s top left corner.
  • BottomCenter: Places the FAB on the bottom-center position of the target.
  • BottomRight: Positions the FAB at the target’s bottom right corner. To refresh the position of FAB on target resize, use refreshPosition method. The position will be refreshed automatically when browser resized.

    <button ejs-fab id='fab' content='fab' [position]='position'></button>
import { Component } from '@angular/core';
import { FabPosition } from '@syncfusion/ej2-angular-buttons';

@Component({
    selector: 'app-root',
    templateUrl: 'app.component.html',
    encapsulation: ViewEncapsulation.None
})

export class AppComponent { 
    public position:FabPosition = 'BottomLeft';
}

Defaults to FabPosition.BottomRight

target

string | HTMLElement

Defines the selector that points to an element in which the FAB will be positioned. By default, FAB is positioned based on viewport of browser. The target element must have relative position, else FAB will get positioned based on the closest element which has relative position.

Defaults to

visible

boolean

Defines whether the fab is visible or hidden.

Defaults to true.

Methods

click

Click the button element its native method

Returns void

destroy

Destroys the FAB instance.

Returns void

focusIn

Sets the focus to Button its native method

Returns void

getPersistData

Get the properties to be maintained in the persisted state.

Returns string

refreshPosition

Refreshes the FAB position. You can call this method to re-position FAB when target is resized.

Returns void