Skip to content

Commit 7041867

Browse files
(Icon): add title, currentColor, and flip props
1 parent b486052 commit 7041867

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

src/scripts/Icon.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ export type IconProps = {
269269
textColor?: IconTextColor;
270270
tabIndex?: number;
271271
fillColor?: string;
272+
title?: string;
273+
currentColor?: boolean;
274+
flip?: boolean;
272275
} & SVGAttributes<SVGElement>;
273276

274277
/**
@@ -359,8 +362,16 @@ export const SvgButtonIcon = (
359362
*/
360363
export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>(
361364
(props) => {
362-
const { label, circleContainer, containerClassName, fillColor, ...rprops } =
363-
props;
365+
const {
366+
label,
367+
circleContainer,
368+
containerClassName,
369+
fillColor,
370+
title,
371+
currentColor,
372+
flip,
373+
...rprops
374+
} = props;
364375
let { category = 'utility', icon } = props;
365376

366377
useInitComponentStyle();
@@ -394,10 +405,17 @@ export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>(
394405
category === 'utility'
395406
? `slds-icon-utility-${icon.replace(/_/g, '-')}`
396407
: null,
397-
fillIconColor ? `slds-icon-${fillIconColor}` : null
408+
fillIconColor ? `slds-icon-${fillIconColor}` : null,
409+
{
410+
'slds-current-color': currentColor,
411+
'slds-icon_flip': flip,
412+
}
398413
);
414+
415+
const iconTitle = title || label;
416+
399417
return (
400-
<span className={ccontainerClassName} title={label}>
418+
<span className={ccontainerClassName} title={iconTitle}>
401419
<SvgIcon
402420
ref={svgIconRefCallback}
403421
{...rprops}

0 commit comments

Comments
 (0)