-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Tailwind 4 support #1643
Comments
If you migrated locally using the CLI and are using the default theme (not New York) you may want to remove |
I think shadcn upstream is still working on fully supporting tailwind 4. Here's a discussion thread on that project. Here's a recent pull request on the topic. It sounds like there is some fundamental changes that needs to happen to the setup, which depends on the now deprecated tailwind config file. Likewise there is some work needed on a per-component basis that is currently beong worked on. @huntabyte, are you familiar with this issue, do you have an update, and do you have an idea what needs to be done in this repo for the tailwind migration? |
I have already successfully migrated my project to Tailwind v4, I will push a migration commit for my project tomorrow or in a few days so you can take a look. |
This is the migration commit of my project, as promised: |
you can downgrade to tailwind 3 version to fix the issues |
I used the upgrade command from tailwind ( |
Thank you @wiesson, using |
As @wiesson suggested, using I was able to downgrade to I think a key issue is that TailwindCSS 4.x has dropped the requirement for a There have also been changes to the utility classes that need to be reflected in the components. Whilst |
This issue has gone from "nice to have" to required for functionality with the latest SvelteKit updates. SvelteKit, now, by default uses TailwindCSS 4 and no longer generates the necessary "tailwind.config.ts" file. Meaning, you cannot use |
This is why we have pinned the sv version to a version that still supports tailwind v3. Please take a look at our installation docs. |
@Wombosvideo You're a lifesaver. Looking at your project showed me what I needed that I couldn't find anywhere else. |
I have a small starter repo that can be used. Built based on @Wombosvideo setup. |
I also made an unofficial turborepo starter for sveltekit + shadcn and migrated it to Tailwind v4 here. |
Any updates on this ? |
As mentioned above #1643 (comment) |
While we wait for the official tailwind 4 integration, what worked for me was to:
That worked for me |
Another way for Astro svelte is to
The CSS looks like this: @theme {
} @Utility container {
} |
@brnkgabriel Your |
Are you able to remove the tailwind.config.ts from your repo since tailwind 4 doesn't use it anymore? |
Why install bits-ui? Can you be a little more specific about how this whole method makes it work? Thanks |
@joelremix my repo doesn't have a |
It's not just updating Tailwind, numerous components need to be updated as well. For example, the sidebar doesn't work correctly in v4. |
Did you update tailwindcss-animate? https://github.com/Wombosvideo/tailwindcss-animate-v4 |
I did the update and it is working, thks for the tip. But what I meant is that it is necessary for shadcn-svelte to update the components for direct support of v4 in the repository. Those who updated Tailwind to v4 may face problems when installing a new component. If only the v4 migrate/upgrade script could run again, it wouldn’t be a big issue. |
Sidebar is working great for me, no issues on tailwind 4 |
I also ran into that problem. There is a --force flag for the upgrade command, but it doesn't seem to do anything. I wish you could specify a specific directory and force an upgrade only for that directory, but alas. |
@memark you can install all components with |
I have been using this simple bash script to replace it with v4 classes that I can run after updating components. sed -i -E 's/\[--([^]]*)\]/\(--\1\)/g; s/outline-none/outline-hidden/g' fileName Here is the full script that loops over all files and runs sed. #!/usr/bin/env bash
GREEN=$'\e[0;32m'
RED=$'\e[0;31m'
NC=$'\e[0m'
process_directory() {
local dir="$1"
if [[ ! -d "$dir" ]]; then
echo "Error: Directory '$dir' not found."
return 1
fi
find "$dir" -name "*.svelte" -print0 | while IFS= read -r -d $'\0' item; do
sed -i -E 's/\[--([^]]*)\]/\(--\1\)/g; s/outline-none/outline-hidden/g' $item
echo "${GREEN}${NC} "$item
done
find "$dir" -mindepth 1 -type d -print0 | while IFS= read -r -d $'\0' subdir; do
process_directory "$subdir"
done
}
process_directory "./src/lib/components/ui/"
echo "${GREEN} Tailwind 4 updated all! ${NC}"
exit 0 |
Prerequisites
Describe the feature
Tailwind 4 has been released https://tailwindcss.com/blog/tailwindcss-v4 and it would be nice to see some official support here!
Ticket in shadcn/ui
👉 shadcn-ui/ui#6427
The text was updated successfully, but these errors were encountered: