-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi_select somewhat usable #1861
Conversation
(as long as it's already formatted as an option dict)
also needs diff --git a/reflex/components/forms/multiselect.py b/reflex/components/forms/multiselect.py
index 9625e15..430418b 100644
--- a/reflex/components/forms/multiselect.py
+++ b/reflex/components/forms/multiselect.py
@@ -48,6 +48,7 @@ class Select(Component):
library = "chakra-react-select"
tag = "Select"
+ alias = "MultiSelect"
# Focus the control when it is mounted
auto_focus: Var[bool] |
allow it to be used along with normal Select component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me
Hi @masenf Is there a way to populate it on the UI with a few selected options from the backend? Like with other components, we can use the So for example I have a select with Monday, Tuesday, ..., Sunday options. Thx! |
Try to address #1791, but this component is cursed.
Because of how the component expects to get certain props (
options
is a list of dict rather than child components, sorx.foreach
cannot be used). It's not a great candidate for wrapping in reflex because Var operations have to compile down to frontend javascript and the transformations necessary to make the component ergonomic to use are not currently implemented.And it looks like the component was contributed without tests or documentation, which makes it even harder to use, understand and catch behavioral regressions.
I have some small tweaks in this PR that make it actually possible to work with it, although it's not the nicest component and I'm not sure if/how it works with
rx.form
... Basically it needs some serious love and attention from someone who deeply understands reflex internals (and might even require some refactoring ofrx.foreach
to emitVar
in addition toComponent
.)Here is some sample code that can run with this PR