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

md-snackbar (toast) #115

Closed
jelbourn opened this issue Feb 27, 2016 · 18 comments
Closed

md-snackbar (toast) #115

jelbourn opened this issue Feb 27, 2016 · 18 comments
Assignees
Labels
blocked This issue is blocked by some external factor, such as a prerequisite PR feature This issue represents a new feature or feature request rather than a bug or bug fix intern project! This issue is part of an intern project! https://careers.google.com/students/ new component This issue is tracking a new component to be added to the library
Milestone

Comments

@jelbourn
Copy link
Member

https://www.google.com/design/spec/components/snackbars-toasts.html

Depends on #113

@jelbourn jelbourn added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Feb 27, 2016
@jelbourn jelbourn added this to the before beta milestone Feb 27, 2016
@jelbourn jelbourn changed the title mdToast md-toast Feb 27, 2016
@jelbourn jelbourn added the new component This issue is tracking a new component to be added to the library label Feb 27, 2016
@jelbourn jelbourn added intern project! This issue is part of an intern project! https://careers.google.com/students/ blocked labels Mar 8, 2016
@jelbourn jelbourn changed the title md-toast md-snackbar (toast) Sep 1, 2016
@jelbourn jelbourn assigned josephperrott and unassigned iveysaur Sep 1, 2016
@jelbourn
Copy link
Member Author

jelbourn commented Sep 2, 2016

Status update:
Design doc
Proof of concept

@jelbourn
Copy link
Member Author

Closing this since we have an initial version

@alorle
Copy link

alorle commented Nov 7, 2016

As Material Design specification says, a SnackBar may or may not have an action. There any way to add a SnackBar without any action for now?

@angular/material 2.0.0.alpha.9-3

@jammerware
Copy link

@AlvaroOrduna I was able to add an actionless SnackBar by passing null as the actionLabel argument to snackBar.open.

@mhmo91
Copy link

mhmo91 commented Nov 30, 2016

Duration doesn't work with me, it doesn't even exist in the config class
i'm using version "@angular/material": "^2.0.0-alpha.10",
Also, how about the color of the toaster? like danger, warning, success... thankss

@jammerware
Copy link

@mhmo91 I don't think build with the duration property has been pushed to the npm feed yet. The commit in question was only made just under a couple of weeks ago.

@cheresier
Copy link

cheresier commented Dec 15, 2016

I have a suspicion that the viewContainerRef setting of MdSnackBarConfig is not working correctly. I have a component (let's call it CompanyComponent) that consists of one MdCard with a button inside of it. Pressing the button opens an MdSnackBar. Since each card has a button that opens a snack bar I want the snack bar to be anchored to the bottom of each card. Multiple instances of the CompanyComponent appear in the parent, AppComponent. I open the snack bar using the following code:

    @ViewChild(MdCard, { read: ViewContainerRef }) card;    
    showSnackbar() {
        this.snackbar.open('UPDATED', '', { viewContainerRef: this.card });
    }

I confirmed in the debugger that this.card is defined and assigned a correct ViewContainerRef object.

Once again, I am trying to open the snack bar at the bottom of each card. However, the snack bar opens at the bottom of the browser view port instead (in the AppComponent, not attached to any individual instance of CompanyComponent or MdCard inside of it). Am I doing something wrong, or does there seem a to be a bug?

@jelbourn
Copy link
Member Author

@cheresier That's not what viewContainer is for. Setting the viewContainer tells Angular where the loaded component lives in terms of dependency injection and change detection, but does not affect where it is rendered. Per material design spec, the snack bar always renders at the edge of the screen.

@cheresier
Copy link

@jelbourn, a-ha! Got it. Thank you! Can you point to any other material component I should be using for this use case?

@jelbourn
Copy link
Member Author

You may just want make your own component and conditionally show/hide it at the bottom of the card.

@kuncevic
Copy link
Contributor

kuncevic commented Jan 3, 2017

How would you control the position of the snackbar? I can see in the sample it is appearing just in the bottom. How would you display it in the right top corner ? And also how would you stack the multipe snackbars appearing on the screen?

@jammerware
Copy link

@kuncevic See this comment above. I don't think the position of the snackbar is exposed to the end developer because the material spec doesn't allow it.

@kuncevic
Copy link
Contributor

kuncevic commented Jan 3, 2017

Just went thorugh this https://material.io/guidelines/components/snackbars-toasts.html

Only one snackbar may be displayed at a time.

Snackbars animate upwards from the bottom edge of the screen.

So what I was asking for above is actually against the material spec. @jesselpalmer thanks for pointing that out.

@MikeMatusz
Copy link

On tablet/desktop the material spec does allow for some variation in position:

Alignment: Centered or left-aligned 24dp from the left and bottom edges of the screen

Are there any plans to support the bottom/left alignment?

@ethanmick
Copy link

@MikeMatusz brings up a good point, the snackbar can be positioned in the bottom left on Desktop/Tablet. Should there be a new issue for that functionality?

@mtpultz
Copy link

mtpultz commented Apr 6, 2017

@MikeMatusz and @ethanmick do you think your last two comments should be moved to a new issue since this issue doesn't actually refer to the position and has been closed. Wondering if it won't get noticed, but is a case that needs to be addressed.

@MikeMatusz
Copy link

@mtpultz Good call, I'll create one right now.

andrewseguin added a commit to andrewseguin/components that referenced this issue Oct 15, 2018
@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 5, 2019
@mmalerba mmalerba added the blocked This issue is blocked by some external factor, such as a prerequisite PR label Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked This issue is blocked by some external factor, such as a prerequisite PR feature This issue represents a new feature or feature request rather than a bug or bug fix intern project! This issue is part of an intern project! https://careers.google.com/students/ new component This issue is tracking a new component to be added to the library
Projects
None yet
Development

No branches or pull requests