-
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
Docs hard to comprehend #4863
Comments
We definitely agree that combining the hooks can be cumbersome, and that is one of the reasons we created React Aria Components. We're hoping these unstyled components can be an easier way to get started, and they can choose to drop down to hooks if they need something more custom.
These are categorized, where the categorizes are sorted alphabetically, so there isn't necessarily a relationship between order and dependency in the menu.
Beyond the examples in the docs, we recommend looking at the source code of individual React Spectrum components to get more ideas for implementation. Hopefully that helps, and again, we're hoping that developer experience is improved by using the unstyled components as a starting point. Feel free to create a Discussion or Issue for specific ideas or recommendations. |
So, I've thought about possible solutions, and here are some, in no particular order:
|
Wholeheartedly agree with all the points you've brought up @Faithfinder 💯 I've implemented a I'm now looking to extend this component to support multiple selection, and I'm simply at a loss as to how to do it. There are no such examples in the docs, and mentions of multiple selection seem to be scattered across several doc pages. It's pretty confusing. Digging through source code of React Spectrum isn't exactly great DX - it would be super helpful to have more examples of these fairly common use cases. |
Multiple selection is not supported by Select, which is why you are not finding it. You could use ListBox with a popover to implement that though. |
Ah, I see. Thanks for the clarification @devongovett. The State Management section in the |
I was also looking for a way to implement multiple selection with |
Definitely agree with this. I guess this is a downside of the heavy use of composition in this library, or maybe just in the docs. If the
Reading #2140, it seems like this may or may not come to the Select component. Until then, what would be a "recipe" for implementing it be? <DialogTrigger>
// "All Selected" | "None Selected" | "N Selected" | "Some option label" (if exactly 1 selected)
<Button>2 items selected</Button>
<Popover>
<Dialog>
<ListBox>
<ListBoxItem />
</ListBox>
</Dialog>
</Popover>
</DialogTrigger> What about something like this? Where I don't need a type-able combobox or de-selectable tag pills, I just want a button trigger with a concatenated label and a popover. |
Provide your feedback here.
We're currently trying to build Select/MultiSelect components (which I guess you would call "TagField", when it's finally it's turn to be implemented?). React-Aria seems like the best choice feature-wise, but comprehension has been a struggle. I think I grasped the part that at the core, I just need to manage and pass around a
Collection
andSelectionManager
, however the details are elusive.For example:
ListBox
is a critical part of any such component, and is mentioned in most of relevant docs. Moreover, it's mentioned with the idea that we can build it once and just reuse. However usage examples are different in different pages:useListBox
itself puts useListState inside theListBox
componentuseSelect
instead passes state fromuseSelectState
as a propuseListData
is made for building a collection where keys need to be massaged a bit to be useable, however in that exampleListBox
acceptsitems
andselectedKeys
, notstate
.Then, the docs menu is sorted... A bit weird? There's
useSingleSelectListState
at the top, but it's really just a building block foruseSelectState
that's at the bottom of the list?I'm at a loss as to what pattern is suggested. Also, the types are all referencing each other. I've been staring at words
List
Select
Props
Options
andState
in, it seems, all possible combinations, for the last 3 days, and am feeling quite exhausted.The text was updated successfully, but these errors were encountered: