Skip to content

Conversation

@reidbarber
Copy link
Member

@reidbarber reidbarber commented Oct 22, 2025

Includes guides for Collections, Forms, Client Side Routing, and Selection.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Oct 22, 2025

@reidbarber reidbarber changed the title docs: S2 selection guide docs: S2 Selection + Collection guides Oct 24, 2025
@rspbot
Copy link

rspbot commented Oct 24, 2025

@reidbarber reidbarber changed the title docs: S2 Selection + Collection guides docs: S2 Selection + Collections guides Oct 24, 2025
@reidbarber reidbarber changed the title docs: S2 Selection + Collections guides docs: S2 Guides Oct 27, 2025
@rspbot
Copy link

rspbot commented Oct 27, 2025

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving for testing

/*- end focus -*/

return (
<TableView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda unfortunate that we don't have ListView or standalone ListBox for S2. Perhaps a Picker or ComboBox would be preferable to a single column TableView? Not too bothered by this tbh, just felt kinda odd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we can probably improve this. There is probably a different endpoint that has more properties that we can use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit unrelated since this PR is for S2, but should this also exist on the RAC side? Or was it omitted there on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Selection is represented by a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) containing the `id` of each selected item. You can also pass any iterable collection (e.g. an array) to the `selectedKeys` and `defaultSelectedKeys` props, but the `onSelectionChange` event will always pass back a Set.

<ExampleSwitcher type="component" examples={['CardView', 'Menu', 'SelectBoxGroup', 'TableView', 'TagGroup', 'ToggleButtonGroup', 'TreeView']}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Picker be here as well? Similar question w/ regard to the Single Selection section too


</ExampleSwitcher>

## Item actions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the CardView examples here also have a more constrained size like the previous examples? Will help with the scroll jumping when all the examples above change size from CardView to an example that is smaller in height

export const tags = ['links', 'navigation'];
export const description = 'Integrating client side routing with React Spectrum';

# Client Side Routing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we were planning on merging this into a "Framework setup" page, but ok for now.


ComboBox, SegmentedControl, and Tabs only support single selection and use the `selectedKey` prop (singular) rather than `selectedKeys`.

<ExampleSwitcher type="component" examples={['CardView', 'ComboBox', 'Menu', 'SegmentedControl', 'SelectBoxGroup', 'TableView', 'Tabs', 'TagGroup', 'ToggleButtonGroup', 'TreeView']}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol that's a lot of examples 😂 do we need to show every single component?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it does feel heavy.

@reidbarber reidbarber added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit 5c62b4d Oct 27, 2025
34 checks passed
@reidbarber reidbarber deleted the s2-selection-guide branch October 27, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants