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

Toast - customize theme and position #12

Open
abotalebie opened this issue Oct 29, 2022 · 5 comments
Open

Toast - customize theme and position #12

abotalebie opened this issue Oct 29, 2022 · 5 comments

Comments

@abotalebie
Copy link

Is there any way for customize toast theme and position?

@acidjazz
Copy link
Member

@abotalebie there is nothing particular other than overriding the CSS classes yourself - you can see the defaults here https://github.com/fumeapp/tailvue/blob/main/src/toast.ts#L6-L14

@abotalebie
Copy link
Author

My question is exactly the same.
How can I override CSS classes?

@acidjazz
Copy link
Member

acidjazz commented Oct 31, 2022

well one idea: i set an id to the container element all of the toasts fire from here - maybe you can do something like this:

#toasts {
  @apply tailwind classes here;
}

or maybe go after the children:

#toasts > div {
  @apply tailwind classes here;
}

please report back if you try this and it works - be great for the docs

@abotalebie
Copy link
Author

abotalebie commented Oct 31, 2022

Tanks, Yes It works

I applied the changes with the following codes for move toasts to bottom of page and apply RTL direction

#toasts {
  align-self: end;

  .mr-4 {
    margin-right: 0;
    margin-left: 1rem;
  }
  .ml-4 {
    margin-right: 1rem;
    margin-left: 0;
  }
  .ml-3 {
    margin-right: 0;
    margin-left: 0.75rem;
  }
}

But it would be better if there was a simple way to customize toasts position, classes and icons.
Also, support for right-to-left mode is required.

@acidjazz
Copy link
Member

Glad to hear this works - ill update the readme and think about a way to add official support when i get time - otherwise feel free to submit a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants