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] Add Menu child components as static properties of the Menu component #2583

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions packages/core/src/components/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Menus display lists of interactive items.

@## JavaScript API

The `Menu`, `MenuItem`, and `MenuDivider` components are available in the **@blueprintjs/core**
package. Make sure to review the [getting started docs for installation info](#blueprint/getting-started).
The `Menu` component is available in the **@blueprintjs/core** package. The package also includes
two small helper components: `MenuItem` and `MenuDivider`. These can be referenced by their aliases
as well: `Menu.Item` and `Menu.Divider`, respectively. Make sure to review the
[getting started docs for installation info](#blueprint/getting-started).

The `Menu` API includes three stateless React components:

Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import * as React from "react";

import * as Classes from "../../common/classes";
import { IProps } from "../../common/props";
import { MenuDivider } from "./menuDivider";
import { MenuItem } from "./menuItem";

export interface IMenuProps extends IProps {
/** Whether the menu items in this menu should use a large appearance. */
Expand All @@ -21,6 +23,9 @@ export interface IMenuProps extends IProps {
export class Menu extends React.Component<IMenuProps, {}> {
public static displayName = "Blueprint2.Menu";

public static Divider = MenuDivider;
public static Item = MenuItem;

public render() {
const classes = classNames(Classes.MENU, { [Classes.LARGE]: this.props.large }, this.props.className);
return (
Expand Down