Need help with nativescript-floatingactionbutton?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

nstudio
133 Stars 38 Forks Other 265 Commits 20 Opened issues

Description

Material Design Floating Action Button in NativeScript apps.

Services available

!
?

Need anything else?

Contributors list

NativeScript-FloatingActionButton

NativeScript plugin for Material Design Floating Action Button UI component.

Action Build npm npm

Installation

Nativescript 7+:

ns plugin add @nstudio/nativescript-floatingactionbutton

NativeScript lower than 7:

tns plugin add @nstudio/[email protected]

Screenshot


FAB Android Screenshot FAB iOS Screenshot

Multiple FAB/Swipe Animation Support

FAB Animations

Usage

The icon for the FAB can be a local image in your app or an image/icon from the App_Resources.

Plain NativeScript

    
    
        
            
                
            
        
            
    


NativeScript Angular

import { registerElement } from 'nativescript-angular/element-registry';
registerElement(
  'Fab',
  () => require('@nstudio/nativescript-floatingactionbutton').Fab
);

HTML

    


NativeScript Vue

import Vue from 'nativescript-vue';

Vue.registerElement( 'Fab', () => require('@nstudio/nativescript-floatingactionbutton').Fab );

Template



CSS

Recommended CSS styles.

.fab-button {
  height: 70;
  width: 70; /// this is required on iOS - Android does not require width so you might need to adjust styles
  margin: 15;
  background-color: #ff4081;
  horizontal-align: right;
  vertical-align: bottom;
}

Use Icon Fonts

First you need to setup icon fonts as described in NativeScript documentation.

After this, you can use icon fonts on FAB by specifiying the unicode as text and add the

fas
/
far
class:


API

| Property | Android | iOS | Description | Note | | --------------------- | ------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | | backgroundColor | X | X | Sets the background color of the button | | icon | X | X | Supports the same image source options that NativeScript images support | Required on android | | text | X | X | Allows to use text instead of image | Can be styled with

font-*
and
color
CSS properties | | rippleColor | X | | Ripple color on lollipop devices, it will fill the FAB on pre-lollipop devices | None | | hideOnSwipeOfView | X | X | Directs the fab to animate itself in and out on scroll | Pass it the name of the view to monitor for a scroll event example: hideOnSwipeOfView="userListView" | | hideAnimationDuration | X | X | How many milliseconds it takes for the button to hide. | Default if not set: 300ms | | swipeAnimation | X | X | slideDown, slideUp, slideLeft, slideRight, scale | Default is slideDown | | androidScaleType | X | | center, centerCrop, centerInside, fitCenter, fitEnd, fitStart, fitXY, matrix
for more details see Android-Docs | Default is center |

iOS Notes

  • We're using MNFloatingActionButton by Matt Nydam
  • Width\Height are requried properties
  • icon is a required property, if left as empty string default will be shown

Running Demo Apps

npm run demo.android

// or

npm run demo.ios

Changelog

Contributors

|
Brad Martin
|
Steve McNiven-Scott
|
Nathanael Anderson
|
Gabriel Marinho
| | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |

|
Alexander Vakrilov
|
Lázaro Danillo Menezes
|
Jofferson Ramirez Tiquez
|
Ravi
| | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |

|
Samuel Ikechukwu
|
Stanimira Vlaeva
| | | | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- |

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.