ui icon indicating copy to clipboard operation
ui copied to clipboard

Incorrect compound button variants types

Open radqut opened this issue 10 months ago • 2 comments

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

3.0.2

Reproduction

https://github.com/nuxt/ui/blob/v3/src/theme/button.ts

Description

I want to customize a button variant by size, trailing and square params. It works, but the types are broken.

The line in the compoundVariants: { size: 'md', trailing: true, square: false, class: { trailingIcon: '-mr-1' } }

Errors: Type '{ trailingIcon: string; }' is not assignable to type 'string'

Additional context

No response

Logs


radqut avatar Mar 30 '25 14:03 radqut

Same issue here!

In the meantime, <!-- @vue-ignore --> above the component in the .vue file removes the linter error

jeannen avatar Apr 16 '25 02:04 jeannen

I had the same error, my compoundVariants settings were in the wrong place :

ui: {
  button: {
    slots: {
      compoundVariants: [
        { color: 'primary', variant: 'solid', class: 'text-white' },
        { color: 'success', variant: 'solid', class: 'text-white' },
        { color: 'info', variant: 'solid', class: 'text-white' },
        { color: 'warning', variant: 'solid', class: 'text-white' },
        { color: 'error', variant: 'solid', class: 'text-white' },
      ],
    },
  },
},

changed to

ui: {
  button: {
    slots: {},
    compoundVariants: [
      { color: 'primary', variant: 'solid', class: 'text-white' },
      { color: 'success', variant: 'solid', class: 'text-white' },
      { color: 'info', variant: 'solid', class: 'text-white' },
      { color: 'warning', variant: 'solid', class: 'text-white' },
      { color: 'error', variant: 'solid', class: 'text-white' },
    ],
  },
},

ziadsarour avatar Apr 23 '25 13:04 ziadsarour