question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: toast, cannot render only button and have container fit width

See original GitHub issue

Prerequisites

Describe the Feature Request

i really like the Toast Component, but in 99% of my apps i ending up implementing my own toast’s, which has mostly two reasons:

  • Swipeable feature (there exists a PR for that since a long time: #23124)
  • Click handler on the toast itself - not a specific button

The second one is the one i want to target in here 😊

Describe the Use Case

It would be great beeing able to add a click handler to the whole toast. Two things i would use this for:

  • “Undo” toast after an action
  • In most apps i fetch push notifications when you are in app and present them via a toast - like instagram does.

For both cases the click handler would help a lot, as an extra button is not very nice here.

Describe Preferred Solution

This should work similar to the handler of e.g. an alert button: Called on click and you can return a boolean | Promise<boolean> that says if you should dismiss or don’t dismiss the toast

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
liamdebeasicommented, Jul 20, 2022

The wrapper element itself is not a button, so it should not be clickable. It would definitely be easier, but having the container (with headers/messages) be clickable is not really how toast was intended to be used.

0reactions
EinfachHanscommented, Jul 20, 2022

Wouldn’t it be easier then to just add a click handler? 🤔 This would also give the advantage that it would work with header and message for example

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - React-Bootstrap Rows/Columns are not the full width of ...
All I am trying to do (in my React project) is position 2 elements on the screen side by side, the element on...
Read more >
Ext.layout.container.Fit | Ext JS 6.2.0 - Sencha Documentation
This is a base class for layouts that contain a single item that automatically expands to fill the layout's container. This class is...
Read more >
Toast | Components - BootstrapVue
Toasts have a semi-transparent background by default. To disable the default transparency, just set the solid prop to true to remove the alpha...
Read more >
Button | Android Developers
However these software-rendered usages are discouraged and have compatibility issues with hardware-only rendering features such as Config.
Read more >
JavaScript Data Grid Configuration - DevExtreme - DevExpress
When this property is set to true, all columns adjust their width to the content. ... DevExtreme HTML5 JavaScript DataGrid Export Button.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found