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

Question about <Menu/> component #83

Open
papazip opened this issue Sep 14, 2022 · 1 comment
Open

Question about <Menu/> component #83

papazip opened this issue Sep 14, 2022 · 1 comment

Comments

@papazip
Copy link

papazip commented Sep 14, 2022

How can i put element between Menu.item when i work with version >=4.20.0

For example, in older version i can do this
"<*Menu >"
"<*Menu.Item >Home</Menu.Item>"
"<h1 >List</h1>"
"<Menu.Item >Search</Menu.item>"
"<
/Menu >"

in new version if i create a list and do " items={items}" in Menu component, how can i put element h1 between Menu Item

@elmolm
Copy link

elmolm commented Mar 10, 2023

import React from 'react';
import { HomeOutlined, SearchOutlined} from '@ant-design/icons';
import type { MenuProps } from 'antd';
import { Menu } from 'antd';

type MenuItem = Required<MenuProps>['items'][number];

const items: MenuItem[] = [
  {
    label: 'Home',
    icon: <HomeOutlined />
  }, {
    type: 'group',
    label: <h1>List</h1>
  }, {
    label: 'Search',
    icon: <SearchOutlined />
  }
];

const App = (): JSX.Element => {
  return (
    <Menu
      items={items}
    />
  );
};

export default App;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants