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

Question: Styling Using TailwindCSS #81

Open
nickpoulos opened this issue Jun 2, 2023 · 1 comment
Open

Question: Styling Using TailwindCSS #81

nickpoulos opened this issue Jun 2, 2023 · 1 comment

Comments

@nickpoulos
Copy link

Hello, I was hoping to use this library but to re-style the component using a class based approach, a la TailwindCSS.

From the docs I was unsure how to go about this, it seems like only CSS variables or Svelte style block is supported.

Is it possible to add custom classes to various pieces of this toast component?

Thanks!

@zerodevx
Copy link
Owner

zerodevx commented Jun 3, 2023

Hey, you can try applying tailwind classes with user-defined classes. The classes are applied to each toast item. YMMV though, because of CSS specificity.

Generally I'll recommend using the exposed CSS vars and/or the Svelte :global modifier.

<div class="wrap">
  <SvelteToast />
</div>

<style lang="postcss">
.wrap :global(.toastItem) {
  --toastPadding: 1rem;
  ...
  @apply text-xs font-bold ...;
}
</style>

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