# Remove default widgets

**URL:** <https://community.cumulocity.com/t/remove-default-widgets/7568>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [May 16, 2024, 11:37am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568 "2024-05-16T11:37:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bishan\_T\_Prasad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bishan\_T\_Prasad](https://community.cumulocity.com/u/Bishan_T_Prasad)\
**Post date:** [May 16, 2024, 11:37am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568/1 "2024-05-16T11:37:58Z")

</div>

Hi,

Is there a way to remove the out of the box widgets from widget selection?

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/cumulocity/original/3X/d/1/d1e30b340cfb4ec50f432f3f21a5f212b984d440.jpeg)  
Here i want to just keep the custom widgets and remove all cumulocity widgets. Any pointer on how this can be achieved would be helpful.

---

<div class="post-metadata">

**Author:** ![Bishan\_T\_Prasad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bishan\_T\_Prasad](https://community.cumulocity.com/u/Bishan_T_Prasad)\
**Post date:** [May 17, 2024, 5:07am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568/2 "2024-05-17T05:07:51Z")

</div>

Hi,  
Any one aware of this?

---

<div class="post-metadata">

**Author:** ![Tristan\_Bastian](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/tristan_bastian/32/18259_2.png) [@Tristan\_Bastian](https://community.cumulocity.com/u/Tristan_Bastian)\
**Post date:** [May 17, 2024, 9:51am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568/3 "2024-05-17T09:51:46Z")

</div>

You can remove widgets by removing their corresponding entry/module in the `ng1.ts` and/or `app.module.ts` files.

As an alternative you could try to override the [`getWidgetDefinitions` method of the `WidgetService`](https://resources.cumulocity.com/documentation/websdk/ngx-components/injectables/WidgetService.html#getWidgetDefinitions).

Regards,  
Tristan

---

<div class="post-metadata">

**Author:** ![Bishan\_T\_Prasad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bishan\_T\_Prasad](https://community.cumulocity.com/u/Bishan_T_Prasad)\
**Post date:** [May 23, 2024, 4:55am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568/4 "2024-05-23T04:55:42Z")

</div>

I couldn’t do it by removing entries from ng.ts file as not all entries of widgets are there.  
But I was able to solve by overriding the WidgetService. This is how I did it.

```auto
--- custom-widget.service.ts ---

import { Inject, Injectable } from '@angular/core';
import { DynamicComponentDefinition, DynamicComponentService } from '@c8y/ngx-components';
import { CONTEXT_DASHBOARD_CONFIG, ContextDashboardConfig, WidgetService } from '@c8y/ngx-components/context-dashboard';
import { TranslateService } from '@ngx-translate/core';

@Injectable()
export class CustomWidgetService extends WidgetService {
  widgetsToBeShown = [
// Add widget id that needs to be shown
 ]

  constructor(dynamicComponentService: DynamicComponentService, translateService: TranslateService,
    @Inject(CONTEXT_DASHBOARD_CONFIG) moduleConfig: ContextDashboardConfig) {
    super(dynamicComponentService, translateService, moduleConfig);
  }

  getWidgetDefinitions() {
    this.widgets = this.widgets.filter((widget: DynamicComponentDefinition) => this.widgetsToBeShown.includes(widget.id))
    return this.widgets
  }
}

--- app.module.ts ---

providers: [
    CustomWidgetService,
    { provide: WidgetService, useClass: CustomWidgetService }
]

```

Thanks for the hint @Tristan_Bastian

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [November 19, 2024, 4:55am UTC](https://community.cumulocity.com/t/remove-default-widgets/7568/5 "2024-11-19T04:55:54Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
