npm package: @pitaya-components/fab
Description: Pitaya-Framework Component FAB.
Author: Pitaya Solutions
Latest version: 0.0.5

<h1 align="center">FAB</h1>

<p align="center"><img height="250" src="https://demo.pitaya-framework.com/media/readme/logo-fab.svg"></p>

<p align="center">
<a href="https://npmcharts.com/compare/@pitaya-components/fab?minimal=true"><img alt="npm" src="https://img.shields.io/npm/dw/@pitaya-components/fab"></a>
<a href="https://www.npmjs.com/package/@pitaya-components/fab"><img alt="npm" src="https://img.shields.io/npm/v/@pitaya-components/fab"></a>
<a href="https://www.npmjs.com/package/@pitaya-components/fab"><img alt="NPM" src="https://img.shields.io/npm/l/@pitaya-components/fab"></a>
</p>
<!-- https://shields.io -->

## Description <a name="description"></a>

[Pitaya-framework](https://github.com/pitaya-foundation/pitaya-framework) template component.

_This documentation assumes you are at least slightly familiar with [aurelia](https://aurelia.io/) and its usage. If not, we highly suggest you take a look at its [Quick Start](https://aurelia.io/docs/tutorials/creating-a-todo-app) section first to get a better understanding of the approaches that are presented it here._

## Screenshot
![Screenshot](https://demo.pitaya-framework.com/media/readme/screenshot-fab.png "Screenshot")


## [Demo](https://demo.pitaya-framework.com/#/fab?component=only)

## MDC Design & API Documentation <a name="mdc-design-and-api-documentation"></a>

- [Material Design guidelines: Buttons](https://material.io/go/design-buttons)
- [MDC Button Demo](https://material-components.github.io/material-components-web-catalog/#/component/button)
- [MDC Button Documentation](https://material.io/develop/web/components/buttons/)
- [MDC Button Github Source](https://github.com/material-components/material-components-web/tree/master/packages/mdc-button)

## Installation

```bash
npm install @pitaya-components/master-component --save
```

## Basic Usage

### Import
You have a few options when importing a component into your layout:

##### Template
```html
<template>
	<require from="@pitaya-components/master-component/dist/native-modules/master-component"></require>
    ...
</template>
```

##### View model
```ts
@viewResources( "@pitaya-components/master-component/dist/native-modules/master-component" )
export class MyView
{
	...
}
```

##### Global resources
```ts
export function configure( config: FrameworkConfiguration )
{
	config.globalResources( [
		PLATFORM.moduleName( "@pitaya-components/master-component/dist/native-modules/master-component" )
	] );
}
```

### Initialization
Our components are usually initialized by defining them in your views HTML.
And can be accessed afterwards in the corresponding view model.

##### Template
```html
<template>
	<master-component
		view-model.ref="masterComponent"
		on-attached.call="_masterComponentHasBeenAttached(component)"
	></master-component>
	...
</template>
```

##### View model
```ts
import {MasterComponent} from "@pitaya-components/master-component";

export class MyView
{
	public component: MasterComponent;

	public doSomething()
	{
		this.component.title = "Bananarama";
	}
}
```

## Variants

### Simple component
Put different variants here

```html
<master-component></master-component>
```

## Event handlers
Attaching an event handler is as simple as adding `on-<event>.call="<function>(<parameters>)"`.
The function that you specify has to be defined as a method on the view model class, so that aurelias template engine can use it.

##### Template
```html
<pitaya-button	
	on-click.call="myButtonHasBeenClicked(event)"
>
	BUTTON LABEL
</pitaya-button>
```

##### View model
```ts
export class MyView
{
	public myButtonHasBeenClicked(event: CustomEvent)
	{
		console.log("Event detail:", event.detail);
	}
}
```

You also can pass any parameter you like.
Specifying `event` just tells the component that you wish to receive the event object, but if you define something else, it will be passed down to your function just like one would expect.

##### Template
```html
<pitaya-button	
	on-click.call="myButtonHasBeenClicked('my custom message')"
>
	BUTTON LABEL
</pitaya-button>
```

##### View model
```ts
export class MyView
{
	public myButtonHasBeenClicked(message: string)
	{
		console.log(message);
	}
}
```

## Bindables
A bindable is part of a core functionality of aurelia which basically allows you to configure a component from within your HTML code.
They can be set/accessed via HTML attribute and also programmatically.

##### Template
```html
<master-component	
	title="Super duper template component"
></master-component>
```

##### View model
```ts
import {MasterComponent} from "@pitaya-components/master-component";

export class MyView
{
	public component: MasterComponent;
	
	public someMethod()
	{
		this.component.title    = "Super duper template component";
	}
}
```
### Bindable properties
| Attribute / Property | Type
| --- | --- |
| `title` |  `string`
| `on-attached` |  `( component ) => {}`

## Methods and properties

| Method Signature | Description
| --- | --- |
| `title: string` | Sets the title
| `onAttached: Function` | Sets the onAttached callback
| `reinitialize() => Promise <void> \| void` | Reinitializes the component

## Style Customization
### SASS mixins
| Mixin | Desciption
| --- | --- |
| `master-component-background` |  Sets the background color

With this component we are relying on the [PLACEHOLDER] component of [MDC](https://github.com/material-components/material-components-web/tree/master/packages/mdc-button).
Check out the [documentation](https://github.com/material-components/material-components-web/tree/master/packages/mdc-button#sass-mixins) to learn how to use their SASS mixins.

## Dependencies

| Package | Url |
| --- | --- |
| `aurelia-framework` | [aurelia-framework](https://github.com/aurelia/framework) |
| `Aurelia-typed-observable-plugin` | [Aurelia-typed-observable-plugin](https://github.com/aurelia-contrib/aurelia-typed-observable-plugin) |

## Changes

The main repository uses tagged [Releases](https://github.com/pitaya-components/master-component/releases) to communicate changes between versions.

## FAQ

**Q:** Why another JavaScript framework? \
**A:** Read [this article](https://github.com/pitaya-components/master-component) for a detailed overview of ours goals.

## Reach Out!

Find us on [Twitter](https://twitter.com/...) for the latest news, and please consider giving us a ?? star on [GitHub](https://github.com/pitaya-components/master-component)!

## Support



For contributions in the form of bug fixes and changes, feel free to use [Pull Requests](https://github.com/pitaya-components/master-component/pulls) or send us a DM on Twitter to discuss how best to approach your issue.

## License

The Master component source code is licensed under the MIT license.