fix: button should use primitive
This commit is contained in:
parent
58bad186dc
commit
bf4e8862c1
|
|
@ -1,8 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { Primitive, type PrimitiveProps } from 'radix-vue'
|
||||
import { buttonVariants } from '.'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface Props {
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: NonNullable<Parameters<typeof buttonVariants>[0]>['variant']
|
||||
size?: NonNullable<Parameters<typeof buttonVariants>[0]>['size']
|
||||
as?: string
|
||||
|
|
@ -14,10 +15,11 @@ withDefaults(defineProps<Props>(), {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
<Primitive
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</Primitive>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { Primitive, type PrimitiveProps } from 'radix-vue'
|
||||
import { buttonVariants } from '.'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface Props {
|
||||
interface Props extends PrimitiveProps {
|
||||
variant?: NonNullable<Parameters<typeof buttonVariants>[0]>['variant']
|
||||
size?: NonNullable<Parameters<typeof buttonVariants>[0]>['size']
|
||||
as?: string
|
||||
|
|
@ -14,10 +15,11 @@ withDefaults(defineProps<Props>(), {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
<Primitive
|
||||
:as="as"
|
||||
:as-child="asChild"
|
||||
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</Primitive>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user