Skip to content

Commit

Permalink
Add menu item label classname
Browse files Browse the repository at this point in the history
  • Loading branch information
spefley committed Dec 19, 2018
1 parent 8e1e03d commit eb9a181
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/components/menu/menuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export interface IMenuItemProps extends IActionProps, ILinkProps {
*/
labelElement?: React.ReactNode;

/**
* Classname for the right-aligned label wrapper element.
*/
labelClassName?: string;

/**
* Whether the text should be allowed to wrap to multiple lines.
* If `false`, text will be truncated with an ellipsis when it reaches `max-width`.
Expand Down Expand Up @@ -136,12 +141,12 @@ export class MenuItem extends React.PureComponent<IMenuItemProps & React.AnchorH
}

private maybeRenderLabel(labelElement?: React.ReactNode) {
const { label } = this.props;
const { label, labelClassName } = this.props;
if (label == null && labelElement == null) {
return null;
}
return (
<span className={Classes.MENU_ITEM_LABEL}>
<span className={classNames(Classes.MENU_ITEM_LABEL, labelClassName)}>
{label}
{labelElement}
</span>
Expand Down

1 comment on commit eb9a181

@blueprint-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add menu item label classname

Previews: documentation | landing | table

Please sign in to comment.