1
0

dashboard-widget-config.mdx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. ---
  2. title: "DashboardWidgetConfig"
  3. generated: true
  4. ---
  5. ## DashboardWidgetConfig
  6. <GenerationInfo sourceFile="packages/admin-ui/src/lib/core/src/providers/dashboard-widget/dashboard-widget-types.ts" sourceLine="11" packageName="@vendure/admin-ui" />
  7. A configuration object for a dashboard widget.
  8. ```ts title="Signature"
  9. interface DashboardWidgetConfig {
  10. loadComponent: () => Promise<Type<any>> | Type<any>;
  11. title?: string;
  12. supportedWidths?: DashboardWidgetWidth[];
  13. requiresPermissions?: string[];
  14. }
  15. ```
  16. <div className="members-wrapper">
  17. ### loadComponent
  18. <MemberInfo kind="property" type={`() => Promise<Type<any>> | Type<any>`} />
  19. Used to specify the widget component. Supports both eager- and lazy-loading.
  20. *Example*
  21. ```ts
  22. // eager-loading
  23. loadComponent: () => MyWidgetComponent,
  24. // lazy-loading
  25. loadComponent: () => import('./path-to/widget.component').then(m => m.MyWidgetComponent),
  26. ```
  27. ### title
  28. <MemberInfo kind="property" type={`string`} />
  29. The title of the widget. Can be a translation token as it will get passed
  30. through the `translate` pipe.
  31. ### supportedWidths
  32. <MemberInfo kind="property" type={`DashboardWidgetWidth[]`} />
  33. The supported widths of the widget, in terms of a Bootstrap-style 12-column grid.
  34. If omitted, then it is assumed the widget supports all widths.
  35. ### requiresPermissions
  36. <MemberInfo kind="property" type={`string[]`} />
  37. If set, the widget will only be displayed if the current user has all the
  38. specified permissions.
  39. </div>