shadcn-vue/apps/www/src/lib/registry/default/ui/button/Button.vue
Roman Hrynevych 825f14e8b5
fix: add whitespace-nowrap for Button, Select, Tab (#266)
* 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
2024-01-13 00:04:05 +03:30

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>