* fix(Button): add 'whitespace-nowrap' to base styles * refactor(Button): use VariantProps for Button Props instead of NonNullable * fix(Select): add whitespace-nowrap and truncate to SelectTrigger
31 lines
711 B
Vue
31 lines
711 B
Vue
<script setup lang="ts">
|
|
import type { VariantProps } from 'class-variance-authority'
|
|
import { Primitive, type PrimitiveProps } from 'radix-vue'
|
|
import { buttonVariants } from '.'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface ButtonVariantProps extends VariantProps<typeof buttonVariants> {}
|
|
|
|
interface Props extends PrimitiveProps {
|
|
variant?: ButtonVariantProps['variant']
|
|
size?: ButtonVariantProps['size']
|
|
as?: string
|
|
}
|
|
|
|
withDefaults(defineProps<Props>(), {
|
|
variant: 'default',
|
|
size: 'default',
|
|
as: 'button',
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<Primitive
|
|
:as="as"
|
|
:as-child="asChild"
|
|
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
|
|
>
|
|
<slot />
|
|
</Primitive>
|
|
</template>
|