Search code examples
antd

How to use newline in Notification with antd


I tried to use \n in my notification's decription but it did not work. what should I use instead.

notification.warning({
    message: 'Notification Title',
    description:
      'This is the content of the notification.\n This is the content of the notification. This is the content of the notification.',
  });

Solution

  • It's quite simple. Just use HTML instead of a string.

    notification.warning({
      message: 'Notification Title',
      description: (
          <>
             This is the content of the notification.<br />
             This is the content of the notification. This is the content of the notification.
          </>
      ),  
    });
    

    Here I made a demo for you.