Closed
Description
Describe the feature / bug 📝:
Using a variety of functions, such as toast() or toast.custom(), whether passing a jsx component or otherwise, adding the dismissible prop has no effect.
Steps to reproduce the bug 🔁:
- In terminal:
npx create-react-app sonner && cd sonner
npm i sonner
- In greenfield project (App.js):
import logo from './logo.svg';
import './App.css';
import { toast } from 'sonner';
import { Toaster } from 'sonner';
function App() {
return (
<div className="App">
<Toaster />
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<button onClick={() => toast(<div>A custom toast with default styling</div>, { dismissible: false })}>Trigger toast</button>
</header>
</div>
);
}
export default App;
- Click button.
- Toast is dismissed after default duration.
Metadata
Metadata
Assignees
Labels
No labels