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

[Tag] Always keep the span element outside of tagContent to support more flexible custom design #4289

Closed
zhangpaopao0609 opened this issue Jun 13, 2024 · 2 comments
Labels
to be published to be published

Comments

@zhangpaopao0609
Copy link
Collaborator

zhangpaopao0609 commented Jun 13, 2024

Details

As the title shows, I want to always keep the span element outside of tagContent to support more flexible custom design.

Now, the src/tag/tag.tsx code is as follows.

You can see that tagContent will be wrapped by span only when maxWidth is not undefined. Otherwise, no one can style it, such as adding a background color only to the tagContent area or setting a color only for tagContent. So I suggest that regardless of whether maxWidth is undefined, we still add span

      return (
        <div class={tagClass.value} style={tagStyle.value} onClick={handleClick}>
          {icon}
          {props.maxWidth
            ? (
              <span class={{ [`${COMPONENT_NAME.value}--text`]: props.maxWidth }} title={titleAttribute}>
                {tagContent}
              </span>
              )
            : (
                tagContent
              )}
          {!props.disabled && closeIcon}
        </div>
      );
Copy link
Contributor

👋 @zhangpaopao0609,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@zhangpaopao0609 zhangpaopao0609 changed the title [Tag] add a span element outside of tagContent to support more flexible custom design [Tag] Always keep the span element outside of tagContent to support more flexible custom design Jun 13, 2024
@uyarn uyarn added the to be published to be published label Jun 19, 2024
@uyarn
Copy link
Collaborator

uyarn commented Jun 28, 2024

fixed 1.9.7

@uyarn uyarn closed this as completed Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
to be published to be published
Projects
None yet
Development

No branches or pull requests

2 participants