admin管理员组

文章数量:1313162

I am using Notification ponent from ant design and I want to remove close (X) button from Notification box.

I've tried adding closable: false and icon: null but not working

notification.info({
    description: "Sample description",
    closable: false,
    icon: null 
})

I am using Notification ponent from ant design and I want to remove close (X) button from Notification box.

I've tried adding closable: false and icon: null but not working

notification.info({
    description: "Sample description",
    closable: false,
    icon: null 
})
Share Improve this question edited Jul 17, 2019 at 12:30 Dennis Vash 54k12 gold badges117 silver badges132 bronze badges asked Jul 17, 2019 at 11:28 sakethsaketh 331 silver badge5 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

if you are using Ant Design >= 3.x notification have a property call closeIcon which accepts ReactNode you can use closeIcon : (<div></div>) to hide the close icon. check the doc here Notification Component

Happy Coding...

Ant Design Notification doesn't accept closable prop. Please read the documentation.

I use Angular with ng-zorro. In the documentation there is this part. nzCloseIcon --> Custom close icon --> TemplateRef | string

I use a TemplateRef to do it.

html:

`<ng-template #none></ng-template>`

ts:

  @ViewChild("none", { static: false }) none?: TemplateRef<{}>;

this.nzNotification.template(
  this.template!, { nzCloseIcon: this.none }
);

本文标签: javascriptRemove default close ( X ) button from ant design NotificationStack Overflow