Change icon of ui.stepper step #5151
-
First Check
Example Codefrom nicegui import ui
def mix():
# Change icon here
stepper.next()
with ui.stepper().props('vertical').classes('w-full') as stepper:
with ui.step('Preheat'):
ui.label('Preheat the oven to 350 degrees')
with ui.stepper_navigation():
ui.button('Next', on_click=stepper.next)
with ui.step('Ingredients'):
ui.label('Mix the ingredients')
with ui.stepper_navigation():
ui.button('Mix', on_click=mix)
ui.button('Next', on_click=stepper.next)
ui.button('Back', on_click=stepper.previous).props('flat')
with ui.step('Bake'):
ui.label('Bake for 20 minutes')
with ui.stepper_navigation():
ui.button('Done', on_click=lambda: ui.notify('Yay!', type='positive'))
ui.button('Back', on_click=stepper.previous).props('flat')
ui.run() DescriptionI would like to change the icon of the step if "mixing" fails. How to archive this? NiceGUI Version2.24.1 Python Version3.12.2 BrowserChrome Operating SystemWindows Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
Anindya088
Sep 18, 2025
Replies: 1 comment 1 reply
-
Hi @nils-ossenbrink , Do you mean something like this? from nicegui import ui
def mix():
# Change icon here
ingredients.props('active-icon="warning" active-color="red" done-icon="warning" done-color="red"')
mix_label.set_text('Sorry! Mixing failed')
mix_label.classes('text-red')
with ui.stepper().props('vertical').classes('w-full') as stepper:
with ui.step('Preheat'):
ui.label('Preheat the oven to 350 degrees')
with ui.stepper_navigation():
ui.button('Next', on_click=stepper.next)
with ui.step('Ingredients') as ingredients:
mix_label = ui.label('Mix the ingredients')
with ui.stepper_navigation():
ui.button('Mix', on_click=mix)
ui.button('Next', on_click=stepper.next)
ui.button('Back', on_click=stepper.previous).props('flat')
with ui.step('Bake'):
ui.label('Bake for 20 minutes')
with ui.stepper_navigation():
ui.button('Done', on_click=lambda: ui.notify('Yay!', type='positive'))
ui.button('Back', on_click=stepper.previous).props('flat')
ui.run() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nils-ossenbrink
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @nils-ossenbrink ,
Do you mean something like this?