Skip to content

Handling Toast actions (buttons and links) #11

@jackbsteinberg

Description

@jackbsteinberg

When the developer is creating a toast in HTML using , they can include in the children button(s) that will take some action upon user feedback. At this point, the intention is to have an actionclick event that would fire when a with a single button or link has had that button or link clicked.

I see two issues with including this as our action support:

  • It doesn't address a case where the developer wants to put two action buttons in the toast.
  • It doesn't address how to add actions using the showToast() function.

A proposal that came up in #9 to solve this second issue was to allow the developer to pass in an action like so:

const toast = showToast("message", {
  action: ['Click me', doSomething]
});

This same pattern could also be used to pass in a list of actions, but would have the same issue with actionclick. This pattern would also need to be amended to support both buttons and links.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions