Skip to content

Commit

Permalink
add htmlTitle prop to Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeboning committed Dec 5, 2018
1 parent 12827db commit 319da39
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/core/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ export interface IIconProps extends IIntentProps, IProps {
* explicit falsy value to disable.
*/
title?: string | false | null;

/**
* String for the title attribute on the rendered element, which will appear
* as a tooltip in the browser.
*/
htmlTitle?: string;
}

export class Icon extends React.PureComponent<IIconProps & React.DOMAttributes<HTMLElement>> {
Expand All @@ -88,6 +94,7 @@ export class Icon extends React.PureComponent<IIconProps & React.DOMAttributes<H
intent,
title = icon,
tagName: TagName = "span",
htmlTitle,
...htmlprops
} = this.props;

Expand All @@ -100,7 +107,7 @@ export class Icon extends React.PureComponent<IIconProps & React.DOMAttributes<H
const viewBox = `0 0 ${pixelGridSize} ${pixelGridSize}`;

return (
<TagName {...htmlprops} className={classes}>
<TagName {...htmlprops} className={classes} title={htmlTitle}>
<svg fill={color} data-icon={icon} width={iconSize} height={iconSize} viewBox={viewBox}>
{title && <desc>{title}</desc>}
{paths}
Expand Down

0 comments on commit 319da39

Please sign in to comment.