fkhadra / fkhadra/react-toastify

Add custom data attributes to Toasts

Open
#695 3 comments 3 reactions 0 assignees View on GitHub
Feature Request
Dominant language
TypeScript
Stars
13.4k
Forks
741
PR merge metrics
No merged PRs in 30d

Description

Hi and thank you for `react-toastify`! Using it has been very straightforward so far 👍

**Do you want to request a *feature* or report a *bug*?**
A *feature*

**What is the current behavior?**
We can add ids and classes to the toasts, but no data attributes.

**What is the expected behavior?**
We can additionally add data attributes to toasts, eg via
```js
toast('🦄 Wow so easy!', {
...
dataAttributes: {
'data-cy': 'unicorn-toast'
}
});
```
so that the resulting rendered toast has the provided data attributes
![image](https://user-images.githubusercontent.com/21658108/150115746-7fdfab7c-16f8-4df6-af3d-53f344a887fe.png)

(obviously we're trying to test the toasts using Cypress und want to adhere to the [best practices](https://docs.cypress.io/guides/references/best-practices#Selecting-Elements) and use `data-cy` attributes instead of IDs or classes)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.