Setting default props on ui.notification
#4330
Replies: 2 comments 5 replies
-
Hi, @thetableman! As you pointed out, the Anyway, following your logic, you might want to set default props as follows: ui.notification._default_props['options'] = {'position': 'top'} Sadly, that won't help much either, because import functools
from nicegui import ui
notification_defaults = {'position': 'top'}
my_notification = functools.partial(ui.notification, **notification_defaults)
my_notification('Message')
ui.run() |
Beta Was this translation helpful? Give feedback.
-
Thanks for bringing this up, @thetableman! We could as well split them into individual props. I already started to do that: https://github.com/zauberzeug/nicegui/tree/notification-props. It still needs some work to also support default props. Primarily we need to clarify how to handle conflicting default_props and default parameter values. E.g., what happens if you set the default timeout to 3.0 and call Actually this question is even bigger: Take |
Beta Was this translation helpful? Give feedback.
-
Question
Consider the following example:
The expected outcome is that the default notification position is now the top but this doesn't seem to occur. When inspecting the
props
applied to the element being called thedefault_props
are added but ignored. It seems that allprops
forui.notification
are actually found in aprops['options']
, but this isn't where the default settings are being added..Beta Was this translation helpful? Give feedback.
All reactions