-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
MdSnackBar: alignment & position #3577
Comments
A good reference for this improvement is the current toast demo page in the Material library (1.1.3). |
@donroyco yes this really awesome. |
Continuing discussion from #115 here. On tablet/desktop the material spec does allow for some variation in position:
It would be nice to at least support the bottom/left alignment. |
What is the final verdict on this? |
Is there any update on this? PR #4045 is open and the latest update was done 12 days ago. |
I had an issue with positioning the snack bars, so I'll leave this for reference:
|
@rsxdalv thanks for sharing your solution. can you please elaborate on the 2nd. section? |
@gil-msbitsoftware You can use negative margins or any layout on them, though relative layout would have to be dynamically calculated within JavaScript. Read the section on inlining if you want to modify global style with components: https://scotch.io/tutorials/all-the-ways-to-add-css-to-angular-2-components However, this approach is pretty ugly - unless you are sure about how to encapsulate the css and manage its lifecycle (egg, if you want to dynamically reposition the elements.) I'd suggest only using it if you have screens that need it in different positions and those positions are screen, not content relative (so you can use viewport percentages). I'm hopefully not going to need to use it past the bugfix, in which case I'm just using a global override in the styles.css. |
If we can adjust snackbar position through config, that would be great. |
When this feature could be released? Is there any desired schedule for this? I am using snackbar and needs to move this bar to the right top, but can not find way to solve this. Is there any special solution to fix this right now? |
@webcat12345 no you are going to have to wait... but yes this build is taking a long while. If you want what is in master now you can download the master version instead of the official version |
does anyone has a workaround for positioning the snackbar on top? |
You could pass in extra CSS values via |
@erangeles @Goodwine yes that is why we are waiting so very patiently for this to be released. lol.... I tried to hack it but it just isn't worth it. I will continue waiting. |
can anyone give me example to change the position and applying css on snackbar |
@Mohitsirf no don't do it. it's not worth it. Unfortunatly we will have to wait longer. |
There is my sample workaround.
|
Closing as #4045 has merged |
please god openSnackBar(message: string, action: string) {
this.snackBar.open(message, action, {
duration: 4000,
location: 'top' // <<<<
});
} |
@ORESoftware What? The right way to do this is: openSnackBar(message: string, action: string) {
this.snackBar.open(message, action, {
duration: 4000,
verticalPosition: 'top',
horizontalPosition: 'end',
});
} Please read the API if you have any other questions |
The alignment is still wrong. The example in the docs creates a snackbar that touches the bottom of the viewport -- for some reason, |
@thw0rted I think it's better to open a new issue, since this one has been closed |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
proposal:
I hope this proposal is respecting the following spec
https://material.io/guidelines/components/snackbars-toasts.html
Snackbars are often used to show a message at the bottom of the screen, but, is there a possibility to config the position: horizontal, vertical, center, bottom, up, left, right ... etc,
What is the expected behavior?
user can choose the position and orientation,
What is the current behavior?
Snackbars is at the bottom of the screen
The text was updated successfully, but these errors were encountered: