Skip to content
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

Clean up exports #650

Closed
vladmoroz opened this issue Sep 27, 2024 · 2 comments · Fixed by #700
Closed

Clean up exports #650

vladmoroz opened this issue Sep 27, 2024 · 2 comments · Fixed by #700
Labels
core Infrastructure work going on behind the scenes

Comments

@vladmoroz
Copy link
Contributor

vladmoroz commented Sep 27, 2024

The DX of importing Base UI components should be cleaned up to avoid unnecessary noise:

  • Each component should be exported once, and not its parts
  • Types should be namespaces under component name
  • Hooks should not be exported

For example, typing Dialog in VSC should not suggest anything but the Dialog component.

Expected import styles:

import { Dialog } from '@base_ui/react';
import * as Dialog from '@base_ui/react/Dialog';

Shouldn't be a thing:

import { DialogRoot } from '@base_ui/react';
import type { DialogRootProps } from '@base_ui/react/Dialog/...'
@vladmoroz vladmoroz added the core Infrastructure work going on behind the scenes label Sep 27, 2024
@michaldudak
Copy link
Member

Based on our discussions, we agreed to drop the import * as Foo pattern and replace it with import { Foo }, so it's easier to type and VSCode suggestions include it.

import { Dialog } from '@base_ui/react';
import { Dialog } from '@base_ui/react/Dialog';

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants