Angular Material component that allow users to select a county or nationality
npm install @angular-material-extensions/fab-menu
height="256px" width="256px" style="text-align: center;"
src="https://cdn.jsdelivr.net/gh/angular-material-extensions/fab-menu@master/assets/angular-material-extensions-logo.svg">







src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/ex1.gif">
src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/ex2.gif">
If you like this project, support angular-material-extensions
by starring :star: and sharing it :loudspeaker:
View all the directives and components in action at https://angular-material-extensions.github.io/fab-menu
used to display the main component
---
---
If Angular Material Design is not setup, just run ng add @angular/material learn more
Now add the library via the angular schematics
``shell`
ng add @angular-material-extensions/fab-menu
Now install @angular-material-extensions/fab-menu via:`shell`
npm install --save @angular-material-extensions/fab-menu
If you installed the library via angular schematics, you can skip this step
Once installed you need to import the main module:
`js`
import { MatFabMenuModule } from '@angular-material-extensions/fab-menu';
`typescript
import { MatFabMenuModule } from '@angular-material-extensions/fab-menu';
@NgModule({
declarations: [AppComponent, ...],
imports: [MatFabMenuModule, ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
`
Other modules in your application like for lazy loading import MatSelectCountryModule into your feature module:
| option | bind | type | default | description |
|:-------------------|:--------:|:------:|:------------:|:-------------------------------------------------------------------------------------------------|
| fabButtons | Input() | MatFabMenu[] | - | array of floating actions button as menu to renderInput()
| icon | | string | add | material icon string e.g: home, mail, phone see moreInput()
| direction | | MatFabMenuDirection | top | the direction of buttons: 'top' | 'bottom' | 'left' | 'right';Input()
| color | | ThemePalette | accent | the color of the main fab: primary, accent or warnInput()
| isActive | | boolean | false | Whether the component is activeInput()
| disabled | | boolean | false | Whether the component is disabledInput()
| closeAfterSelection | | boolean | true | Close after selecting a fab menu itemOutput()
| onFabMenuItemSelected | | EventEmitter | - | emits the selected button by id
`typescript`
@ViewChild('matFabMenu', { static: false }) matFabMenu: MatFabMenu;
toggle() will toggle the isActive property
Important interfaces or type
`typescript
import {ThemePalette, TooltipPosition} from '@angular/material';
interface MatFabMenu {
id: string | number;
icon?: string; // please use either icon or imgUrl
iconColor?: ThemePalette;
imgUrl?: string; // please use either icon or imgUrl
tooltip?: string;
tooltipPosition?: TooltipPosition;
color?: ThemePalette;
}
type MatFabMenuDirection = 'top' | 'bottom' | 'left' | 'right';
`
`html
`
`typescript
import {MatFabMenu} from '@angular-material-extensions/fab-menu';
fabButtonsRandom: MatFabMenu[] = [
{
id: 1,
icon: 'create'
},
{
id: 2,
icon: 'mail'
},
{
id: 3,
icon: 'file_copy'
},
{
id: 4,
icon: 'phone'
},
];
`
try to use your own svg instead of material icons:
`typescript
import {MatFabMenu} from '@angular-material-extensions/fab-menu';
fabCountries: MatFabMenu[] = [
{
id: 1,
imgUrl: 'assets/countrys-flags/svg/canada.svg'
},
{
id: 2,
imgUrl: 'assets/countrys-flags/svg/germany.svg'
},
{
id: 3,
imgUrl: 'assets/countrys-flags/svg/france.svg'
},
{
id: 4,
imgUrl: 'assets/countrys-flags/svg/lebanon.svg'
},
];
`
`html`
src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/top.png">
`html`
[fabButtons]="fabButtonsRandom">
src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/bottom.png">
`html`
[fabButtons]="fabButtonsRandom">
src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/left.png">
`html`
[fabButtons]="fabButtonsRandom">
src="https://raw.githubusercontent.com/angular-material-extensions/fab-menu/HEAD/assets/v1/right.png">
Build the library
after installing the dependencies with npm i
`bash`
$ npm run build:lib
Serve the demo app
`bash``
$ npm start
---
Built by and for developers :heart: we will help you :punch:
---
1. Nahaus.de
Are you missing your project or you app? PR me to publish it on the README
This project is supported by jetbrains with 1 ALL PRODUCTS PACK OS LICENSE incl. webstorm
---
Copyright (c) 2019-2022 Anthony Nahas. Licensed under the MIT License (MIT)