Use the default slot to set the label of the Badge.
<template>
<PBadge>Badge</PBadge>
</template>
Use the label prop to set the label of the Badge.
<template>
<PBadge label="Badge" />
</template>
Use the color prop to change the color of the Badge.
<template>
<PBadge color="neutral">Badge</PBadge>
</template>
Use the variant props to change the variant of the Badge.
<template>
<PBadge color="neutral" variant="outline">Badge</PBadge>
</template>
Use the size prop to change the size of the Badge.
<template>
<PBadge size="xl">Badge</PBadge>
</template>
Use the icon prop to show an Icon inside the Badge.
<template>
<PBadge icon="i-lucide:rocket" size="md" color="primary" variant="solid">Badge</PBadge>
</template>
Use the leading and trailing props to set the icon position or the leading-icon and trailing-icon props to set a different icon for each position.
<template>
<PBadge trailing-icon="i-lucide:arrow-right" size="md">Badge</PBadge>
</template>
Use the avatar prop to show an Avatar inside the Badge.
<template>
<PBadge
:avatar="{
src: 'https://github.com/nuxt.png'
}"
size="md"
color="neutral"
variant="outline"
>
Badge
</PBadge>
</template>
class propUse the class prop to override the base styles of the Badge.
<template>
<PBadge class="font-bold rounded-full">Badge</PBadge>
</template>
| Prop | Default | Type |
|---|
| Slot | Type |
|---|
Below is the theme configuration skeleton for the PBadge. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.
export default defineAppConfig({
pohon: {
badge: {
slots: {
base: '',
label: '',
leadingIcon: '',
leadingAvatar: '',
leadingAvatarSize: '',
trailingIcon: ''
},
variants: {
fieldGroup: {
horizontal: '',
vertical: ''
},
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
size: {
xs: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
sm: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
md: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
lg: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
xl: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
}
},
square: {
true: ''
}
},
compoundVariants: [],
defaultVariants: {
color: 'primary',
variant: 'solid',
size: 'md'
}
}
}
};
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineAppConfig({
pohon: {
badge: {
slots: {
base: '',
label: '',
leadingIcon: '',
leadingAvatar: '',
leadingAvatarSize: '',
trailingIcon: ''
},
variants: {
fieldGroup: {
horizontal: '',
vertical: ''
},
color: {
primary: '',
secondary: '',
success: '',
info: '',
warning: '',
error: '',
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
size: {
xs: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
sm: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
md: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
lg: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
},
xl: {
base: '',
leadingIcon: '',
leadingAvatarSize: '',
trailingIcon: ''
}
},
square: {
true: ''
}
},
compoundVariants: [],
defaultVariants: {
color: 'primary',
variant: 'solid',
size: 'md'
}
}
}
};