Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Menu] supports arbitrary HTML attributes #2757

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DISPLAYNAME_PREFIX, IProps } from "../../common/props";
import { MenuDivider } from "./menuDivider";
import { MenuItem } from "./menuItem";

export interface IMenuProps extends IProps {
export interface IMenuProps extends IProps, React.HTMLAttributes<HTMLUListElement> {
/** Whether the menu items in this menu should use a large appearance. */
large?: boolean;

Expand All @@ -27,10 +27,11 @@ export class Menu extends React.Component<IMenuProps, {}> {
public static Item = MenuItem;

public render() {
const classes = classNames(Classes.MENU, { [Classes.LARGE]: this.props.large }, this.props.className);
const { className, children, large, ulRef, ...htmlProps } = this.props;
const classes = classNames(Classes.MENU, { [Classes.LARGE]: large }, className);
return (
<ul className={classes} ref={this.props.ulRef}>
{this.props.children}
<ul {...htmlProps} className={classes} ref={ulRef}>
{children}
</ul>
);
}
Expand Down