diff --git a/src/components/toast/Toast.d.ts b/src/components/toast/Toast.d.ts index 2dfa97a96e..0924ea9685 100644 --- a/src/components/toast/Toast.d.ts +++ b/src/components/toast/Toast.d.ts @@ -14,6 +14,10 @@ export interface ToastMessage { closable?: boolean; sticky?: boolean; life?: number; + className?: string; + style?: object; + contentClassName: string; + contentStyle?: object; } export interface ToastProps { diff --git a/src/components/toast/ToastMessage.js b/src/components/toast/ToastMessage.js index bbcf7f17ce..e531072f08 100644 --- a/src/components/toast/ToastMessage.js +++ b/src/components/toast/ToastMessage.js @@ -94,18 +94,22 @@ class ToastMessageComponent extends Component { render() { const severity = this.props.message.severity; + const contentClassName = this.props.message.contentClassName; + const contentStyle = this.props.message.contentStyle; + const style = this.props.message.style; + const className = classNames('p-toast-message', { 'p-toast-message-info': severity === 'info', 'p-toast-message-warn': severity === 'warn', 'p-toast-message-error': severity === 'error', 'p-toast-message-success': severity === 'success' - }); + }, this.props.message.className); const message = this.renderMessage(); const closeIcon = this.renderCloseIcon(); return ( -
-
+
+
{message} {closeIcon}
diff --git a/src/showcase/toast/ToastDoc.js b/src/showcase/toast/ToastDoc.js index f793f643bc..1ba970e6e4 100644 --- a/src/showcase/toast/ToastDoc.js +++ b/src/showcase/toast/ToastDoc.js @@ -574,6 +574,30 @@ toast.current.show({severity: 'success', summary: 'Success Message', detail: 'Or null Custom content of the message. If enabled, summary and details properties are ignored. + + className + string + null + Style class of the message. + + + style + object + null + Inline style of the message. + + + contentClassName + string + null + Style class of the message content. + + + contentStyle + object + null + Inline style of the message content. + closable boolean @@ -718,7 +742,7 @@ toast.current.show({life: 5000, severity: 'error', summary: 'Error Message', det style - string + object null Inline style of the element.