Carbon: when importing an icon from icon-react "iconTitle" is not working as shown in storybook

Created on 6 Mar 2020  ·  2Comments  ·  Source: carbon-design-system/carbon

What package(s) are you using?

  • [x] carbon-components
  • [x] carbon-components-react

Detailed description

Describe in detail the issue you're having.
React does not recognize theiconTitleprop on a DOM element.
on using icon as component.
Is this issue related to a specific component?
yes carbon/icons-react

What did you expect to happen? What happened instead? What would you like to
see changed?
title tag is added in svg icon

What browser are you working in?
Chrome

What version of the Carbon Design System are you using?
10

What offering/product do you work on? Any pressing ship or release dates we
should be aware of?

Steps to reproduce the issue

  1. import { Delete32 } from "@carbon/icons-react";
  2. <Delete32 role="img" iconTitle="Delete" />

Please create a reduced test case in CodeSandbox

Additional information

  • Screenshots or code
  • Notes
question ❓

Most helpful comment

our icon builders don't handle it out of the box but this would accomplish what you're looking for

<Delete32 role="img">
  <title>Delete</title>
</Delete32>

All 2 comments

I think the iconTitle prop was part of the old Icon component, I'm not sure this functionality exists when directly importing the Icon from @carbon/icons-react.

I believe you can just add the title as a child to render the browser tooltip, or you can use the TooltipIcon component.

our icon builders don't handle it out of the box but this would accomplish what you're looking for

<Delete32 role="img">
  <title>Delete</title>
</Delete32>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

antonmc picture antonmc  ·  3Comments

PatrickDuncan picture PatrickDuncan  ·  3Comments

mouadcherkaoui picture mouadcherkaoui  ·  3Comments

windgaucho picture windgaucho  ·  3Comments

kalyanixraut picture kalyanixraut  ·  3Comments