mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-18 22:11:43 +01:00
* chore: add local module for better dx developing nuxt/ui * up * up * up * feat(Kbd): new * chore(Badge): update * chore(Collapsible): remove content prop * chore(Container): clean * chore(Avatar): update root bg * chore(Link): clean * feat(Tooltip): handle shortcuts * playground(collapsible): update --------- Co-authored-by: Benjamin Canac <canacb1@gmail.com>
38 lines
944 B
Vue
38 lines
944 B
Vue
<script lang="ts">
|
|
import { tv, type VariantProps } from 'tailwind-variants'
|
|
import type { AppConfig } from '@nuxt/schema'
|
|
import _appConfig from '#build/app.config'
|
|
import theme from '#build/ui/badge'
|
|
|
|
const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
|
|
|
|
const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
|
|
|
|
type BadgeVariants = VariantProps<typeof badge>
|
|
|
|
export interface BadgeProps {
|
|
as?: string
|
|
label?: string
|
|
color?: BadgeVariants['color']
|
|
variant?: BadgeVariants['variant']
|
|
size?: BadgeVariants['size']
|
|
class?: any
|
|
}
|
|
|
|
export interface BadgeSlots {
|
|
default(): any
|
|
}
|
|
</script>
|
|
|
|
<script setup lang="ts">
|
|
const props = withDefaults(defineProps<BadgeProps>(), { as: 'span' })
|
|
defineSlots<BadgeSlots>()
|
|
</script>
|
|
|
|
<template>
|
|
<component :is="as" :class="badge({ color, variant, size, class: props.class })">
|
|
<slot>
|
|
{{ label }}
|
|
</slot>
|
|
</component>
|
|
</template> |