Question about .bind_visibility_from() when using ui.select() #3049
-
QuestionThe thing is that I would like to only show the "comments" element when my "data" ui.select() option is "1", when it is "2" I would like the "comments" ui.input() to be invisible. data = ui.select(label='Status', options=[1, 2])
comments = ui.input('Comments').bind_visibility_from(data, 'value') |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
May 10, 2024
Replies: 1 comment 1 reply
-
Hi @miccs0, You can specify the value for when the element should be visible like this: ui.input('Comments').bind_visibility_from(data, 'value', value=1) This is a shorthand for explicitly defining the conversion from an arbitrary value to a boolean visibility like this: ui.input('Comments').bind_visibility_from(data, 'value', lambda v: v == 1) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
miccs0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @miccs0,
You can specify the value for when the element should be visible like this:
This is a shorthand for explicitly defining the conversion from an arbitrary value to a boolean visibility like this: