Socket
Socket
Sign inDemoInstall

ng2-float-btn

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ng2-float-btn

Button group for angular 2 and angular material 2.


Version published
Weekly downloads
9
decreased by-25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Ng2-float-btn

alt tag

Button group for angular 2 and angular material 2.

Installation

Dependecies:
  • Angular 2
  • Angular Material 2
Install package
npm install ng2-float-btn --save

Usage

Setup
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from "@angular/forms"
import { MaterialModule } from '@angular/material';

import { AppComponent } from './app.component';

import { Ng2FloatBtnModule } from 'ng2-float-btn';

@NgModule({
    imports: [ 
        MaterialModule.forRoot(), 
        Ng2FloatBtnModule
    ],
    declarations: [AppComponent],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
Example
import { Component } from '@angular/core';
import { Ng2FloatBtnComponent, Ng2FloatBtn } from 'ng2-float-btn';

@Component({
	selector: 'test-app',
	template: `
		<ng2-float-btn [mainButton]="mainButton" [buttons]="buttons" [isMini]="true" [direction]="'right'">
		
		<div style="z-index:400; position: absolute; bottom: 0;">
			<ng2-float-btn [mainButton]="mainButton" [buttons]="buttons"  [direction]="'up'">
			</ng2-float-btn>
		</div>
	`
})
export class AppComponent {

	mainButton: Ng2FloatBtn;
	buttons: Array<Ng2FloatBtn>;

	public constructor() {

		this.mainButton = {
			color: "primary",
			iconName: "check"
		}

		this.buttons = [
			{
				color: "primary",
				iconName: "add",
				onClick: () => {
					alert("buton 1 clicked");
				},
				label : "button 1"
			},
			{
				color: "primary",
				iconName: "remove",
				onClick: () => {
					alert("buton 2 clicked");
				},
				label : "button 2"
			}
		]
	}
}
Type Definition

Ng2FloatBtn

PropertyTypeDescription
colorstringThe color of the button. Can be primary, accent, or warn(Reference)
iconNamestringThe name of the material icon. Refer to here
onClick(optional)anyThe callback function when the button clicked
label(optional)stringThe label of the button
Element Atributes
AttributeTypeDescription
mainButtonNg2FloatBtnThe main button of the button group. label and onClick will be ignored.
buttonsArrayThe array of button of the collapsed button.
directionstringThe direction that the collapsed fab should expand to when the main button get clicked. Can be right, left, up and down

Keywords

FAQs

Last updated on 12 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc