Why not also export `carbon-components-react` components?
See original GitHub issueSummary
Right now components from carbon-components-react
are passed through the mdx provider so that they can be used in .mdx
files without having to add carbon-components-react
as a dependency. However, those components are not exported.
If a consumer is trying to use any Carbon react components (alongside this theme’s components) in a new component they are creating in a .js
file in their downstream site, there’s no way to utilize something from carbon-components-react
unless the consumer adds that library as an additional dependency.
So you can have a situation where you are using one version of carbon-components-react
in mdx files, and then another version of carbon-components-react
if you have to add it as a dependency in order to import something into a .js
to create your own component, for example, to use your site.
So my question is – why not export all components (that make sense to export) from carbon-components-react
?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
@vpicone Yeah that’s what I was thinking… but in the case where you all have redefined/changed a carbon component in some way, I think it would make sense to export that variation instead, like with the
Tabs
(i.e., export yourTabs
and not the ccrTabs
, to avoid the overlap).Okay just tried to experiment with this and I’m not getting ideal results…
Imagine this structure:
If I want to import
StructuredList
fromcarbon-components-react
into myCustomComponent.js
, I must addcarbon-components-react
as a dependency and import from there, otherwise I get a big error and the page breaks.If I want import
StructuredList
into myindex.mdx
, I also still have to addcarbon-components-react
as a dependency and add import statements at the top of the file. If I don’t and if I just try to useStructuredList
with no import, the page build won’t fail but the component won’t be there.Either way, whether using a Carbon component in a js or mdx file, it appears as though I need to add
carbon-components-rect
as a dependency and import the component from there. 🤔