How do I use Tailwind colour palettes within NuxtUI components that accept a color?
I don't want to just use primary, secondary, etc
In NuxtUI components such as the UBadge, I want the set color="rose" or color="indigo" for example
5 Replies
Hi @Uchuu. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The knowledge sources do not explicitly document support for using arbitrary Tailwind color names (like "rose" or "indigo") directly in Nuxt UI components such as UBadge via the color prop. The documented approach for Nuxt UI is to use semantic color names like "primary", "secondary", "gray", etc., which are mapped in your app.config.ts file. For example:
This allows you to change the color palette globally, but only for the predefined semantic keys, not arbitrary Tailwind color names. Attempting to set color="rose" or color="indigo" in a Nuxt UI component is not shown as supported in the provided sources, and there is no mention of a way to extend the color prop to accept arbitrary Tailwind palette names in Nuxt UI components like UBadge.
If you need more granular control, you may need to customize the component or use utility classes directly, but this is not covered in the knowledge sources provided. If you want to override or extend the theme, you can do so for the semantic keys in app.config.ts, but not for arbitrary Tailwind color names as direct props on Nuxt UI components How to dynamically select primary colour in Nuxt UI?.
I'm sorry, but there's no information in the knowledge sources about using arbitrary Tailwind color names directly as the color prop in Nuxt UI components.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@1035470271441805353> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
after you define the colors in tailwind as mentioned here in the docs
in nuxt config:
in app config:
now enjoy your custom color in
color=""Nuxt UI
Design System - Nuxt UI
Nuxt UI's design system uses Tailwind CSS for simple theming and easy customization.
Thanks worked
Don't mention it <3