Skip to content

Conversation

J-Michalek
Copy link
Collaborator

πŸ”— Linked issue

Resolves #4888

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I've loosened the types around tailwind variants to allow arbitary keys to be passed in as before TS would report an error for custom variants/slots being used in other block of the config.

Ideally we would have this fully typed, but as I discussed with @benjamincanac we cannot do that as of now due to some technical limitations.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions bot added the v4 #4488 label Sep 16, 2025
@J-Michalek
Copy link
Collaborator Author

I still need to address the issue I've described in #4888 (comment) because if a component has no compoundVariants out of the box the user won't get any type support, but they should get atleast the slots/variants predefined by NuxtUI.

Copy link

pkg-pr-new bot commented Sep 16, 2025

npm i https://pkg.pr.new/@nuxt/ui@4992

commit: b3b9007

@J-Michalek J-Michalek changed the title Fix/loosen tv types fix(tv): type issues Sep 16, 2025
@J-Michalek
Copy link
Collaborator Author

So I was able to solve #4992 (comment) pretty easily, but I am still strugling with allowing any value to be passed as the value of the variant (i.e. custom color) as any attempt of remapping the keys of the variants resulted in loss of typing of the original values.

@benjamincanac benjamincanac changed the title fix(tv): type issues fix(types): allow arbitrary keys in tv config Sep 18, 2025
@J-Michalek
Copy link
Collaborator Author

@benjamincanac I've used the type you've shared with me and it works great!

One thing that comes to mind, but in my opinion is not a blocker is that it would be nice to still restrict boolean variants to just boolean because now we allow string to be passed in as well.
image

@benjamincanac benjamincanac merged commit ae77b69 into nuxt:v4 Sep 19, 2025
16 checks passed
benjamincanac added a commit that referenced this pull request Sep 19, 2025
benjamincanac added a commit that referenced this pull request Sep 19, 2025
benjamincanac added a commit that referenced this pull request Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Variant and compoundVariants typing issue
2 participants