Skip to content

Recipe to set Select values dynamically? #3463

Answered by picklelo
thomastiotto asked this question in Q&A
Discussion options

You must be logged in to vote

@thomastiotto take a look at our select docs to see how to bind your select to state.

Your code can be simplified to be

class State(rx.State):
    values : list[str] = []

    def load_values(self):
        self.values = ["a","b"]

and

rx.page(on_load=State.load_values)
def symbols() -> rx.Component:
    return rx.select(State.values)

Replies: 1 comment

Comment options

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