Skip to content

chore: Update docs to use subpaths#9857

Merged
devongovett merged 10 commits intomainfrom
export-children
Mar 30, 2026
Merged

chore: Update docs to use subpaths#9857
devongovett merged 10 commits intomainfrom
export-children

Conversation

@devongovett
Copy link
Copy Markdown
Member

This adds exports for child components into subpaths for their parents. For example react-aria-components/ComboBox includes Input, Button, ListBox, etc. This way you only need one import statement to get everything you need. It also has the side-benefit of improving discoverability of which components are supported within a parent using TS autocomplete.

Also updates the documentation examples and starters to use subpath imports. There are several benefits of subpaths, and the only real downside is needing multiple import statements when using multiple components. It's simpler to update the docs to use subpaths by default than attempt to list them all in the API reference. On the flip side it's easy to use the package index if you want.

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 28, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 28, 2026

Comment on lines +2 to +3
import { Text } from 'react-aria-components/Text';
import { GridListSection, GridListHeader } from 'react-aria-components/GridList';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should really apply lint to our examples so we don't get things like mixed spaces

@@ -12,6 +12,8 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"verbatimModuleSyntax": true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

out of curiosity, why'd you apply this? i don't disagree with it, just curious

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh, i didn't indent to commit this (at least the customConditions). I added verbatimModuleSyntax because apparently vite uses it by default so when people copy and paste our examples they get a ton of errors. Sigh - another case of we have to be more strict than everyone else.

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 30, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Mar 30, 2026

## API Changes

@react-spectrum/s2

/@react-spectrum/s2:RangeValue

+RangeValue <T> {
+  end: T
+  start: T
+}

Copy link
Copy Markdown
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.

Did a spot check in the docs and a quick sweep comparing the API section with what got re-exported, noted some additional components for re-export consideration, lemme now what you think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would exporting Avatar be appropriate here too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same for ComboBox, Picker, ToggleButton, TagGroup?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it's a tradeoff between exporting every possible component you could potentially include and bundle size. I definitely want to include the ones you'd always or at least usually use, and definitely ones that aren't standalone (like Text), but not sure about the less common ones.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thats fair, I'm fine with the current set we have then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this also export Image?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this export LinkButton?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about slot supported children as documented in https://d1pzu54gtk2aed.cloudfront.net/pr/b55aadca2046d5e8969d4df529c2dd8ef98b48da/ListView#slots?

like Image/ActionMenu/ActionGroup? Same kind of deal in Card + TreeView

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe should include Button/ButtonGroup? Seems pretty common to tie though together

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

common but not required... idk

@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Mar 30, 2026

Also happy to approve if we wanna try and get this into testing

@devongovett devongovett added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 45cb5d8 Mar 30, 2026
29 checks passed
@devongovett devongovett deleted the export-children branch March 30, 2026 20:14
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.

4 participants