Skip to content

An opinionated toast component for React.

misc

emilkowalski1a5e9504df90
diff --git a/README.md b/README.md
index 9745b79..f0ca4a4 100644
--- a/README.md
+++ b/README.md
@@ -104,12 +104,13 @@ toast(<div>A custom toast with default styling</div>);
You can use `toast.custom` to render an unstyled toast with custom jsx while maintaining the functionality.
-````jsx
+```jsx
toast.custom((t) => (
<div>
This is a custom component <button onClick={() => toast.dismiss(t)}>close</button>
</div>
));
+```
### Theme
@@ -117,7 +118,7 @@ You can change the theme using the `theme` prop. Default theme is light.
```jsx
<Toaster theme="dark" />
-````
+```
### Position
@@ -201,3 +202,7 @@ You can focus on the toast area by pressing ⌥/alt + T. You can override it by
```jsx
<Toaster hotkey={['KeyC']} />
```
+
+```
+
+```
diff --git a/src/styles.css b/src/styles.css
index 000556b..2c2909c 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -247,7 +247,7 @@
transition: opacity 400ms;
}
-[data-sonner-toast][data-expanded='false'][data-front='false'][data-custom='false'] > * {
+[data-sonner-toast][data-expanded='false'][data-front='false'][data-styled='true'] > * {
opacity: 0;
}
diff --git a/website/src/components/Hero/index.tsx b/website/src/components/Hero/index.tsx
index fd7f009..28c77b9 100644
--- a/website/src/components/Hero/index.tsx
+++ b/website/src/components/Hero/index.tsx
@@ -16,12 +16,9 @@ export const Hero = () => {
<button
data-primary=""
onClick={() => {
- toast.custom((t) => (
- <div>
- <h1>Custom toast</h1>
- <button onClick={() => toast.dismiss(t)}>Dismiss</button>
- </div>
- ));
+ toast('Sonner', {
+ description: 'An opinionated toast component for React.',
+ });
}}
className={styles.button}
>