You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In styled mode, the toast component currently uses hardcoded severity mappings (info, success, warn, error, secondary, contrast). This approach limits its extensibility and creates an inconsistency with components like message, which dynamically handles props.severity.
If this design choice was made to prevent automatic class purging, it would make sense to hardcode severities. However, since the message component's dynamic approach works as intended, this doesn't appear to be a concern.
This request is to update the toast styled mode class generation to use dynamic severity class generation. Doing so would:
Promote the extensibility of toast in styled mode.
Align its behaviour with components like message and inlinemessage.
Simplify the process of extending toast with custom severities by removing the need for pt overrides when design token additions would otherwise suffice.
This enhancement request focuses on the toast component but could also extend to other components like badge and tag, which currently rely on hardcoded severities. Addressing these would further align with PrimeVue's philosophy of flexibility and extensibility.
Thank you for taking the time to read this enhancement request. I'd be happy to provide more details or examples.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In styled mode, the
toast
component currently uses hardcoded severity mappings (info
,success
,warn
,error
,secondary
,contrast
). This approach limits its extensibility and creates an inconsistency with components likemessage,
which dynamically handlesprops.severity
.For reference, here is the relevant
toast
class function:https://github.com/primefaces/primevue/blob/180c921c894f0537767c33b0568754c773caa960/packages/primevue/src/toast/style/ToastStyle.js#L267-L277
In contrast, the
message
component supports dynamic class generation. The root classes function evaluatesprops.severity
and automatically generates corresponding classes without requiring predefined mappings. For reference:https://github.com/primefaces/primevue/blob/180c921c894f0537767c33b0568754c773caa960/packages/primevue/src/message/style/MessageStyle.js#L305-L313
If this design choice was made to prevent automatic class purging, it would make sense to hardcode severities. However, since the
message
component's dynamic approach works as intended, this doesn't appear to be a concern.This request is to update the
toast
styled mode class generation to use dynamic severity class generation. Doing so would:toast
in styled mode.message
andinlinemessage.
toast
with custom severities by removing the need forpt
overrides when design token additions would otherwise suffice.This enhancement request focuses on the
toast
component but could also extend to other components likebadge
andtag
, which currently rely on hardcoded severities. Addressing these would further align with PrimeVue's philosophy of flexibility and extensibility.Thank you for taking the time to read this enhancement request. I'd be happy to provide more details or examples.
Beta Was this translation helpful? Give feedback.
All reactions