Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency in docs for components (example Toast(er) ) #635

Closed
codeagencybe opened this issue Jun 22, 2023 · 15 comments
Closed

Inconsistency in docs for components (example Toast(er) ) #635

codeagencybe opened this issue Jun 22, 2023 · 15 comments
Labels

Comments

@codeagencybe
Copy link

Hello Shad

I was just experimenting with your library first time and was trying the Toaster component but I ran into confusing docs.
Maybe you are still in the process re-documenting stuff?

Anyway, I came across this mismatch information:

image

Your docs says the import has to be like

import { Toaster } from "@/components/ui/toaster"

But the actual component is not toaster but toast and raising errors.

It's nothing major as I just compare the actual file names with your docs but it catches one offguard if you don't look close on the naming convention.

Is there anyway for me and others to help you spotting these changes and do a PR with the correct update for the docs?
I tried searching for the docs in your repo but I think they are not in there?

Thanks!

@dan5py
Copy link
Contributor

dan5py commented Jun 22, 2023

The Toaster component is used as a container for all your toasts and it's recommended to place it at the root of the app. The Toast component instead, is the actual toast element where your data are displayed.

However you need to use the toast function returned by the useToast hook to actually use the component.

import { useToast } from "@/components/ui/use-toast"
...
const { toast } = useToast();

@codeagencybe
Copy link
Author

The Toaster component is used as a container for all your toasts and it's recommended to place it at the root of the app. The Toast component instead, is the actual toast element where your data are displayed.

However you need to use the toast function returned by the useToast hook to actually use the component.

import { useToast } from "@/components/ui/use-toast"
...
const { toast } = useToast();

Yes I know that but your feedback has nothing to do with point I'm reporting.
There is a mistake in the naming convention.

Look closely.
The import line from the docs are pointing to import { Toaster } from "@/components/ui/toaster"

while the actual ui component is toast (not toaster)

If you follow the exact steps from docs, you end up with a non-working example.

@dan5py
Copy link
Contributor

dan5py commented Jun 22, 2023

Now I got it. When your run the add toast command the toaster.tsx isn't created. This an already known issue, like pointed out in #234.

This will be fixed in the next cli version.

For now create the toaster.tsx file by following the manual installation.

@codeagencybe
Copy link
Author

Now I got it. When your run the add toast command the toaster.tsx isn't created. This an already known issue, like pointed out in #234.

This will be fixed in the next cli version.

For now create the toaster.tsx file by following the manual installation.

ahaa! OK seems like I took for my first testing immediately one of the components that's broken lol.
Thanks for pointing out, I will try some other components instead.

Are there any other components like Toaster that are also broken in similar way? Then I can avoid those too for now 😆

PS: what is the way for contributing back to the docs if we spot something? Can we do changes and PR back? Or just report here as issue?

@dan5py
Copy link
Contributor

dan5py commented Jun 22, 2023

Are there any other components like Toaster that are also broken in similar way? Then I can avoid those too for now 😆

Seems the only one for now.

PS: what is the way for contributing back to the docs if we spot something? Can we do changes and PR back? Or just report here as issue?

Sure! PR are well appreciated. Just check that a PR for that issue hasn't already been submitted and you're good to go.

@Tansi-Jones
Copy link

Hello Shad,

I'm also trying to import the toast components, but the installation code is for the Avatar components instead of Toast, please advice??

@dan5py
Copy link
Contributor

dan5py commented Jun 23, 2023

Hi @Tansi-Jones, there's a mistake in the docs of the toast component.

To install the component simply run npx shadcn-ui@latest add toast. After the installation is completed you can follow the rest of the guide, starting from the Add the Toaster component.

If you need the code for the manual installation just let me know.

@Tansi-Jones
Copy link

Thanks @dan5py

@cjonesuk
Copy link

cjonesuk commented Jun 23, 2023

For now create the toaster.tsx file by following the manual installation.

I just tried following the manual installation instructions and the code that it says to copy into my project doesn't contain a component called Toaster. Sorry if i'm missing something obvious.

EDIT: I've grabbed the code from the github repo rather than the website, i think it's just missing a section about the toaster component.

@dan5py
Copy link
Contributor

dan5py commented Jun 23, 2023

EDIT: I've grabbed the code from the github repo rather than the website, i think it's just missing a section about the toaster component.

@cjonesuk yeah with the new version the toast's docs is missing the additional files in the manual installation.

@feyiamujo1
Copy link

The toast documentation is missing the use-toast code for the manual installation

@dan5py
Copy link
Contributor

dan5py commented Jun 29, 2023

The toast documentation is missing the use-toast code for the manual installation

@feyiamujo1 Yeah, I opened an issue (#687) for that.

@castrolem
Copy link

Not sure if this is the best thread, it looks like the manual install of the Toast component is missing the animation/keyframes that are used in the examples.

@lok1984
Copy link

lok1984 commented Jan 31, 2024

http://tinyurl.com/yn5pf84y
i am getting this error when using toaser
Error: (0 , components_ui_use_toast__WEBPACK_IMPORTED_MODULE_3_.useToast) is not a function

@shadcn shadcn added the Stale label Jun 15, 2024
@shadcn
Copy link
Collaborator

shadcn commented Jun 23, 2024

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

@shadcn shadcn closed this as completed Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants