Skip to content
Discussion options

You must be logged in to vote

This is not supported by the ui.radio element. But you can use the new ui.teleport element to inject arbitrary NiceGUI elements:

radio = ui.radio({x: '' for x in ['banana', 'orange', 'apple']}, value='banana')
with ui.teleport(f'#c{radio.id} > div:nth-child(1) .q-radio__label'):
    ui.label('🍌')
with ui.teleport(f'#c{radio.id} > div:nth-child(2) .q-radio__label'):
    ui.label('🍊')
with ui.teleport(f'#c{radio.id} > div:nth-child(3) .q-radio__label'):
    ui.label('🍏')
ui.label().bind_text_from(radio, 'value')

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pierrecdn
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants