Carbon: ListBox is not included in exporting file

Created on 1 Jun 2020  ·  4Comments  ·  Source: carbon-design-system/carbon

carbon-components-react/index.js not includes ListBox component. Therefore, I cannot use like import { ListBox } from 'carbon-components-react'. The only way to use this is to use like import ListBox from 'carbon-components-react/lib/components/ListBox. However, it imports all icons from @carbon/icons-react. Is it bug or intended?

question ❓

Most helpful comment

Thanks for your consideration for ListBox. I'll wait for public API!

All 4 comments

Hey there @baeharam! 👋

Currently, ListBox is considered an internal module but we'd be very interested in making it publicly available if folks are interested in it. This is why one has to directly import it as it's not made available through our public entry point and instead is considered an internal module.

Similarly, when using files from the lib directory you end up with CommonJS modules. CommonJS modules won't tree-shake the way the ESM module will from the carbon-components-react entrypoint.

Thanks! @joshblack

Then, I have some questions.

1) Is there a substitution for ListBox?
2) Can I PR for this component?

Great question, there isn't currently something to use as a direct replacement for Listbox (outside of our dropdown / multi-select / combobox components). For shipping Listbox, I went ahead and created an issue and will try and see if we can get this as part of our public API soon :smile:

Thanks for your consideration for ListBox. I'll wait for public API!

Was this page helpful?
0 / 5 - 0 ratings