Fixed #4863 - Button: new badgeSeverity property

pull/4864/head
tugcekucukoglu 2023-11-22 13:43:05 +03:00
parent f12576ce8e
commit 70efc14382
3 changed files with 9 additions and 1 deletions

View File

@ -30,6 +30,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
badgeSeverity: {
type: String,
default: null
},
loading: { loading: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -116,6 +116,10 @@ export interface ButtonProps extends ButtonHTMLAttributes {
* Style class of the badge. * Style class of the badge.
*/ */
badgeClass?: string | undefined; badgeClass?: string | undefined;
/**
* Severity type of the badge.
*/
badgeSeverity?: 'info' | 'success' | 'warning' | 'danger' | string | null | undefined;
/** /**
* Whether the button is in loading state. * Whether the button is in loading state.
* @defaultValue false * @defaultValue false

View File

@ -9,7 +9,7 @@
<span v-if="icon" :class="[cx('icon'), icon, iconClass]" v-bind="ptm('icon')"></span> <span v-if="icon" :class="[cx('icon'), icon, iconClass]" v-bind="ptm('icon')"></span>
</slot> </slot>
<span :class="cx('label')" v-bind="ptm('label')">{{ label || '&nbsp;' }}</span> <span :class="cx('label')" v-bind="ptm('label')">{{ label || '&nbsp;' }}</span>
<Badge v-if="badge" :value="badge" :class="badgeClass" :unstyled="unstyled" v-bind="ptm('badge')"></Badge> <Badge v-if="badge" :value="badge" :class="badgeClass" :severity="badgeSeverity" :unstyled="unstyled" v-bind="ptm('badge')"></Badge>
</slot> </slot>
</button> </button>
</template> </template>