Skip to content

Commit

Permalink
Merge pull request #409 from lifeomic/list-item-trailing-icon
Browse files Browse the repository at this point in the history
feat: Add custom classname for icon and trailing icon in `<ListItem`
  • Loading branch information
dexterca authored Oct 18, 2023
2 parents 9229702 + ec60fdb commit 8a3e86c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ export interface ListItemProps extends React.ComponentPropsWithoutRef<'li'> {
children?: React.ReactNode;
disabled?: boolean;
icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
iconClassName?: string;
onClick?: any;
secondaryText?: string;
text?: string;
trailingIcon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
trailingIconClassName?: string;
}

export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
Expand All @@ -95,10 +97,12 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
children,
disabled,
icon: Icon,
iconClassName,
onClick,
secondaryText,
text,
trailingIcon: TrailingIcon,
trailingIconClassName,
...rootProps
},
ref
Expand All @@ -121,7 +125,7 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
<Icon
role="img"
aria-hidden
className={classes.icon}
className={clsx(classes.icon, iconClassName)}
width={18}
height={18}
/>
Expand All @@ -146,7 +150,11 @@ export const ListItem = React.forwardRef<HTMLLIElement, ListItemProps>(
<TrailingIcon
role="img"
aria-hidden
className={clsx(classes.icon, classes.trailingIcon)}
className={clsx(
classes.icon,
classes.trailingIcon,
trailingIconClassName
)}
width={18}
height={18}
/>
Expand Down

0 comments on commit 8a3e86c

Please sign in to comment.