Skip to content

Commit f6093b6

Browse files
committed
refactor(CBadge): improve background and text color handling
1 parent e70b9e5 commit f6093b6

File tree

1 file changed

+8
-7
lines changed
  • packages/coreui-vue/src/components/badge

1 file changed

+8
-7
lines changed

packages/coreui-vue/src/components/badge/CBadge.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ import { Color, Shape, TextColor } from '../../props'
55
const CBadge = defineComponent({
66
name: 'CBadge',
77
props: {
8-
/**
9-
* Sets the color context of the component to one of CoreUI’s themed colors.
10-
*
11-
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
12-
*/
13-
color: Color,
148
/**
159
* Component used for the root node. Either a string to use a HTML element or a component.
1610
*/
1711
as: {
1812
type: String,
1913
default: 'span',
2014
},
15+
/**
16+
* Sets the color context of the component to one of CoreUI’s themed colors.
17+
*
18+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
19+
*/
20+
color: Color,
2121
/**
2222
* Position badge in one of the corners of a link or button.
2323
*
@@ -61,7 +61,8 @@ const CBadge = defineComponent({
6161
class: [
6262
'badge',
6363
{
64-
[`text-bg-${props.color}`]: props.color,
64+
[`text-bg-${props.color}`]: props.color && !props.textColor,
65+
[`bg-${props.color}`]: props.color && props.textColor,
6566
'position-absolute translate-middle': props.position,
6667
'top-0': props.position && props.position.includes('top'),
6768
'top-100': props.position && props.position.includes('bottom'),

0 commit comments

Comments
 (0)