base-ui
base-ui copied to clipboard
Clean up exports
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/...'
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';
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.