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

[Feature Request]: As a Developer, I would like to import TagType from carbon #16436

Open
1 task done
Tracked by #16154
digiacomo-a opened this issue May 10, 2024 · 2 comments
Open
1 task done
Tracked by #16154
Labels
area: typescript component: tags proposal: accepted This request has gone through triaging and we are accepting PR's against it.

Comments

@digiacomo-a
Copy link

The problem

Users are often using reusable components to render Tags with different colors (type) based on some status.
To achieve this, a TagType enum needs to be defined because we can not import it from carbon/react.

For instance:

enum TagType {
        red = 'red'
        green....
        ... 
}

interface CustomInterface {
  type: TagType,
  title: string,
}

The solution

Could be nice to define and export a TagType containing all supported types and then import it so that we can use it in our interfaces, couple of examples below.

Examples

Example of an interface for Props, with tagType

import {TagType} from '@carbon/react';

interface CustomInterface {
  tagType: TagType,
  title: string,
}

`<MyCustomCardWithTag tagType={TagType.red} title="Example" />`

Application/PAL

No response

Business priority

Low Priority = release date is not dependent on fix or not upcoming

Available extra resources

I'm happy to contribute if this change can be useful.

Code of Conduct

Copy link
Contributor

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

@digiacomo-a digiacomo-a changed the title [Feature Request]: [Feature Request]: As a Developer, I would like to import TagType from carbon May 13, 2024
@tay1orjones
Copy link
Member

Yes this isn't exported from the root, but it's exported from the root source file and so you can import them like this:

import { TYPES } from '@carbon/react/es/components/Tag/Tag';

I'm not opposed to adding these to the root exports, but we won't be able to do that until everything is converted to .ts, #12513, #16360

For now I'll add this as a subitem of #16154

@tay1orjones tay1orjones added area: typescript proposal: accepted This request has gone through triaging and we are accepting PR's against it. component: tags and removed status: needs triage 🕵️‍♀️ type: enhancement 💡 labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: typescript component: tags proposal: accepted This request has gone through triaging and we are accepting PR's against it.
Projects
Status: ⏱ Backlog
Status: Todo
Development

No branches or pull requests

2 participants