Radial menu in Angular Speed dial component
27 Apr 20244 minutes to read
The Angular Speed Dial action items can be displayed in a circular patter like a radial menu by setting mode
property. You can customize the direction
, startAngle
, endAngle
and offset
by setting radialSettings
property.
Radial menu direction
You can open the action items in either clockwise or anticlockwise by setting direction
property. The default value is Auto
where the action items are displayed based on the position
property of the Speed Dial.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<!-- To Render SpeedDial component. -->
<button ejs-speeddial id="speeddial" openIconCss='e-icons e-edit' closeIconCss='e-icons e-close' target='#targetElement' [items]='items' mode= 'Radial' [radialSettings]= 'radialSettings'></button>`
})
export class AppComponent {
public items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut' },
{ iconCss: 'e-icons e-copy' },
{ iconCss: 'e-icons e-paste' },
{ iconCss: 'e-icons e-edit' },
{ iconCss: 'e-icons e-save' }
];
public radialSettings: RadialSettingsModel = { direction: 'AntiClockwise' };
}
Radial menu start and end angle
You can modify the start and end angle of action items by setting startAngle
and endAngle
properties. If the angle is not defined, the action items are displayed based on the position
property of the Speed Dial.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<!-- To Render SpeedDial component. -->
<button ejs-speeddial id="speeddial" openIconCss='e-icons e-edit' closeIconCss='e-icons e-close' target='#targetElement' [items]='items' mode= 'Radial' position='MiddleCenter' [radialSettings]= 'radialSettings'></button>`
})
export class AppComponent {
public items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut' },
{ iconCss: 'e-icons e-copy' },
{ iconCss: 'e-icons e-paste' },
{ iconCss: 'e-icons e-edit' },
{ iconCss: 'e-icons e-save' }
];
public radialSettings: RadialSettingsModel = { direction: 'AntiClockwise', startAngle: 180, endAngle: 360 };
}
Offset
You can modify the offset distance between action items and Speed Dial button using offset
property.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<!-- To Render SpeedDial component. -->
<button ejs-speeddial id="speeddial" openIconCss='e-icons e-edit' closeIconCss='e-icons e-close' target='#targetElement' [items]='items' mode= 'Radial' [radialSettings]= 'radialSettings'></button>`
})
export class AppComponent {
public items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut' },
{ iconCss: 'e-icons e-copy' },
{ iconCss: 'e-icons e-paste' }
];
public radialSettings: RadialSettingsModel = { offset: '80px' };
}
Below example demonstrates the radial menu settings of the Speed Dial.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SpeedDialModule } from '@syncfusion/ej2-angular-buttons'
import { Component } from '@angular/core';
import { RadialSettingsModel, SpeedDialItemModel } from '@syncfusion/ej2-angular-buttons';
@Component({
imports: [
SpeedDialModule// Registering EJ2 SpeedDial Module.
],
standalone: true,
selector: 'app-root',
template: `<div id="targetElement" style="position:relative;min-height:350px;border:1px solid;"><div>
<!-- To Render SpeedDial component. -->
<button ejs-speeddial id="speeddial" openIconCss='e-icons e-edit' closeIconCss='e-icons e-close' target='#targetElement' [items]='items' mode= 'Radial' position= 'MiddleRight' [radialSettings]= 'radialSettings'></button>`
})
export class AppComponent {
public items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut' },
{ iconCss: 'e-icons e-copy' },
{ iconCss: 'e-icons e-paste' },
{ iconCss: 'e-icons e-edit' },
{ iconCss: 'e-icons e-save' }
];
public radialSettings: RadialSettingsModel = { offset: '80px', direction: 'AntiClockwise', startAngle: 90, endAngle: 270 };
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));