Menu

Post image 1
Post image 2
1 / 2
0

How to Implement Dropdown on Hover in React with Ant Design 5

DEV Community: antdesign·Aaronn·about 1 month ago
#g1YzTJol
#dev#class#dropdown#button#menu#article
Reading 0:00
15s threshold

In this tutorial, we'll create a dropdown-on-hover feature in React using Ant Design 5. First, you'll need to set up a React project with Ant Design 5. install & setup vite + react + typescript + ant design 5 1.Create a simple dropdown-on-hover in React using Ant Design 5 components such as MenuProps, Dropdown, Space, and the icons DownOutlined and SmileOutlined. import React from ' react ' ; import { DownOutlined , SmileOutlined } from ' @ant-design/icons ' ; import type { MenuProps } from ' antd ' ; import { Dropdown , Space } from ' antd ' ; const items : MenuProps [ ' items ' ] = [ { key : ' 1 ' , label : ( < a target = "_blank" rel = "noopener noreferrer" href = "https://www.antgroup.com" > 1st menu item </ a > ), }, { key : ' 2 ' , label : ( < a target = "_blank" rel = "noopener noreferrer" href = "https://www.aliyun.com" > 2nd menu item (disabled) </ a > ), icon : < SmileOutlined />, disabled : true , }, { key : ' 3 ' , label : ( < a target = "_blank" rel =…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More