Angular ActionSheet - Customize Item Appearance

For a minor customization of ActionSheet buttons, you can define specific fields in button data objects. For example, the following code generates three buttons, the first is not customized, the second is disabled, the type of the third button is danger.

HTML
TypeScript
  • <dx-action-sheet
  • [dataSource]="actionSheetData"
  • </dx-action-sheet>
  • import { DxActionSheetModule } from "devextreme-angular";
  • // ...
  • export class AppComponent {
  • actionSheetData = [
  • { text: "Reply" },
  • { text: "Reply All", disabled: true },
  • { text: "Delete", type: 'danger' }
  • ]
  • }
  • @NgModule({
  • imports: [
  • // ...
  • DxActionSheetModule
  • ],
  • // ...
  • })

If you need a more flexible solution, define an itemTemplate.

HTML
TypeScript
CSS
  • <dx-action-sheet
  • [dataSource]="actionSheetData"
  • [visible]="isActionSheetVisible"
  • itemTemplate="link">
  • <div *dxTemplate="let item of 'link'">
  • <div class="action-sheet-button">
  • <a href="#">{{item.text}}</a>
  • </div>
  • </div>
  • </dx-action-sheet>
  • import { DxActionSheetModule } from "devextreme-angular";
  • // ...
  • export class AppComponent {
  • actionSheetData = [
  • { text: "Reply" },
  • { text: "Reply All" },
  • { text: "Forward" },
  • { text: "Delete" }
  • ];
  • isActionSheetVisible: Boolean = true;
  • }
  • @NgModule({
  • imports: [
  • // ...
  • DxActionSheetModule
  • ],
  • // ...
  • })
  • .action-sheet-button {
  • margin: 5px;
  • padding: 10px;
  • border: 1px dotted #080;
  • background-color: white;
  • }
See Also