Skip to content

Commit

Permalink
Merge pull request #94 from gunnartorfis/web-usage-docs
Browse files Browse the repository at this point in the history
docs: web support
  • Loading branch information
gunnartorfis authored Sep 14, 2024
2 parents c43fa9d + 14e623f commit 47772b3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ function SomeComponent() {
}
```

### Web support

Even though Sonner Native works on the web, it is not recommended to use it there. Instead, use the original [Sonner](https://sonner.emilkowal.ski/).

The following setup is recommended. Add a `sonner.ts` and `sonner.web.ts` file to your project and import from there instead of from this library directly. That way, sonner will be used on the web and sonner-native on native.

```ts
// sonner.ts
export * from 'sonner-native';
```

```ts
// sonner.web.ts
export * from 'sonner';
```

## Documentation

For more advanced usage, check out the [documentation](https://gunnartorfis.github.io/sonner-native/)
Expand Down
16 changes: 16 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ function SomeComponent() {
}
```

### Web support

Even though Sonner Native works on the web, it is not recommended to use it there. Instead, use the original [Sonner](https://sonner.emilkowal.ski/).

The following setup is recommended. Add a `sonner.ts` and `sonner.web.ts` file to your project and import from there instead of from this library directly. That way, sonner will be used on the web and sonner-native on native.

```ts
// sonner.ts
export * from 'sonner-native';
```

```ts
// sonner.web.ts
export * from 'sonner';
```

## Examples

An example can be found in the [`example`](https://github.com/gunnartorfis/sonner-native/tree/main/example) folder.

0 comments on commit 47772b3

Please sign in to comment.