mui / base-ui

Base UI is an open-source library of accessible, unstyled UI components for React.
MIT License
283 stars 47 forks source link

Clean up exports #650

Closed vladmoroz closed 1 month ago

vladmoroz commented 1 month ago

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

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/...'
michaldudak commented 1 month ago

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';
github-actions[bot] commented 1 month ago

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.