Skip to content

Commit 4c04ff7

Browse files
(Icon): add title, currentColor, and flip props
1 parent 9dbeceb commit 4c04ff7

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
/**
@@ -357,8 +360,16 @@ export const SvgButtonIcon = (
357360
*/
358361
export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>(
359362
(props) => {
360-
const { label, circleContainer, containerClassName, fillColor, ...rprops } =
361-
props;
363+
const {
364+
label,
365+
circleContainer,
366+
containerClassName,
367+
fillColor,
368+
title,
369+
currentColor,
370+
flip,
371+
...rprops
372+
} = props;
362373
let { category = 'utility', icon } = props;
363374

364375
useInitComponentStyle();
@@ -392,10 +403,17 @@ export const Icon = createFC<IconProps, { ICONS: typeof ICONS }>(
392403
category === 'utility'
393404
? `slds-icon-utility-${icon.replace(/_/g, '-')}`
394405
: null,
395-
fillIconColor ? `slds-icon-${fillIconColor}` : null
406+
fillIconColor ? `slds-icon-${fillIconColor}` : null,
407+
{
408+
'slds-current-color': currentColor,
409+
'slds-icon_flip': flip,
410+
}
396411
);
412+
413+
const iconTitle = title || label;
414+
397415
return (
398-
<span className={ccontainerClassName} title={label}>
416+
<span className={ccontainerClassName} title={iconTitle}>
399417
<SvgIcon
400418
ref={svgIconRefCallback}
401419
{...rprops}

0 commit comments

Comments
 (0)