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

Add custom class to cdk-overlay-pane in menu #10062

Closed
artemios-git opened this issue Feb 21, 2018 · 11 comments · Fixed by #10097
Closed

Add custom class to cdk-overlay-pane in menu #10062

artemios-git opened this issue Feb 21, 2018 · 11 comments · Fixed by #10097
Assignees
Labels
P4 A relatively minor issue that is not relevant to core functions

Comments

@artemios-git
Copy link

Bug, feature request, or proposal:

Proposal

What is the expected behavior?

cdk-overlay-pane in menu have additional class to customize not only content of menu but all menu block

What is the current behavior?

There is no possibility to add custom class without hacks

What are the steps to reproduce?

http://joxi.ru/nAyM8MjtX6gb5A

What is the use-case or motivation for changing an existing behavior?

Want to have possibility to change all menu not only content inside

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

In case of adding only class i think it is doesnt matter

Is there anything else we should know?

No

@julianobrasil
Copy link
Contributor

Have you tried panelClass input?

@artemios-git
Copy link
Author

panelClass it's not for overlay, its uses "on the menu template that displays in the overlay container. "

@julianobrasil
Copy link
Contributor

So you want to change things like the transparent backdrop color? (Because the panelClass let you control the menu panel already.)

@artemios-git
Copy link
Author

i want to insert custom class here http://joxi.ru/EA4ZvZ5iD8pOxm, not in menu

@crisbeto
Copy link
Member

I think it's a slippery slope if we start adding inputs for all the different elements that leads us to having a bunch of inputs that just proxy classes. You can still add a class to the .mat-menu-panel by having a class on the mat-menu element.

@artemios-git
Copy link
Author

ok, maybe property like backdropClass in dialogs can be added?

crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 22, 2018
Allows for the backdrop class of a menu to be overwritten.

Fixes angular#10062.
@crisbeto crisbeto self-assigned this Feb 22, 2018
@crisbeto crisbeto added has pr P4 A relatively minor issue that is not relevant to core functions labels Feb 22, 2018
jelbourn pushed a commit that referenced this issue Feb 26, 2018
Allows for the backdrop class of a menu to be overwritten.

Fixes #10062.
mmalerba pushed a commit to mmalerba/components that referenced this issue Feb 26, 2018
Allows for the backdrop class of a menu to be overwritten.

Fixes angular#10062.
@fenta23
Copy link

fenta23 commented Apr 24, 2018

it's nice that you guys addressed this feature. But would it be possible to merge it in the current stable version published on npm?

MaterialDesignGuid advice to add a semi transparent white overlay on mobile devices behind floating action buttons menues. With this feature you can add such a class on the cdk overlay.

Because Angular 6 is still rc and a lot of modules are not adopt to it, i can not switch to your latest version.

Or do you have an advice how to get this in 5.2.5 ?

Thanks, Micha.

@mchoraine
Copy link

I succeed to add css for panel with [backdropClass]="'full-width'" and the css :

.cdk-overlay-container .full-width + * > .cdk-overlay-pane {
   width: 100%;
}

@Robstaer
Copy link

Robstaer commented Feb 23, 2019

@chocho01

Can you provide your code in more detail? I'm trying to style the .cdk-overlay-pane for the mat-autocomplete without it affecting the .cdk-overlay-pane for my mat-menu of another element! But i don't know which element can have this [backdropClass]="full-width". I tried it on the mat-autocomplete, but it says that [backdropClass] is not a known input !
Thank you in advance =)

@julianobrasil
Copy link
Contributor

julianobrasil commented Feb 23, 2019

Take a look (on docs) at classList: string. It's not exactly what you want, but maybe it helps a little bit.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants