Change background color of Menubar items when on hover

UI Components for React
Post Reply
martin97peru
Posts: 1
Joined: 25 Aug 2021, 17:19

25 Aug 2021, 17:32

Hi, i can't change the menu items color when on hover
Image
image: https://ibb.co/qdL2Q6c
As you can see, when on hover the color is shown only in the corners, but not on the actual item
This is my css code:

Code: Select all

/*Menubar*/
.p-menubar {
    background-color: var(--primary) !important;
}
.p-menu-list {
    background-color: var(--primary) !important;
}
.p-menuitem {
    background-color: var(--primary) !important;
}
.p-menu-list:hover {
    background-color: #000 !important;
}
.p-menuitem:hover {
    background-color: #000 !important;
}
.p-menuitem-text, .p-menuitem-icon, .p-submenu-icon {
    color: var(--text-primary) !important;
}

mcandu
Posts: 107
Joined: 20 Jan 2021, 16:31

31 Aug 2021, 13:09

Hi,

I don't get what you're trying to do. You mentioned hover but the image you upload pointing focus box-shadow. If you could please be more specific I'd be glad.

peti9585
Posts: 1
Joined: 22 Apr 2023, 12:35

22 Apr 2023, 12:37

Hi,

You can just do this in your components .css file:

Code: Select all

::ng-deep .p-menubar .p-menubar-root-list > .p-menuitem > .p-menuitem-link:not(.p-disabled):hover {
    background-color: your color;
}

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests