Skip to content

Ui3nBadge

Intro

A dot, number, or text that appears in the upper corner of an icon or text indicates that there is new content or pending information.

API

Props

PropsRequiaredDescriptionTypeDefault
dotNoIs the badge a dotbooleanfalse
valueNoThe value shown in the badge (takes effect when dot is false)string | number-
colorNoCustom badge colorstring#00090c
textColorNoCustom value text colorstring#fff
positionNoDefine the position of the logo on other labels when there are other labels in the logo tagright-top | right-bottom | left-top | left-bottomright-top

Slots

NameDescriptionSlot props
defaultThe badge content-

Style variables

VariableDefault
--ui3n-badge-size20px

Examples

The simple badge (as a dot)

The block with the badge (right-top)
The block with the badge (left-top)
The block with the badge (right-bottom)
The block with the badge (left-bottom)

Click me to view the code
vue
<script setup>
  import { Ui3nBadge } from '@v1nt1248/3nclient-lib'
</script>


<template>
  <div>
    <ui3n-badge :dot="true" color="green" :class="$style.badge">
      <span :class="$style.block">The block with the badge (right-top)</span>
    </ui3n-badge>

    <ui3n-badge :dot="true" color="blue" position="left-top" :class="$style.badge">
      <span :class="$style.block">The block with the badge (left-top)</span>
    </ui3n-badge>

    <ui3n-badge :dot="true" color="red" position="right-bottom" :class="$style.badge">
      <span :class="$style.block">The block with the badge (right-bottom)</span>
    </ui3n-badge>

    <ui3n-badge :dot="true" color="yellow" position="left-bottom" :class="$style.badge">
      <span :class="$style.block">The block with the badge (left-bottom)</span>
    </ui3n-badge>
  </div>
</template>

<style lang="scss" module>
.badge {
  margin-bottom: 8px;
}

.block {
  display: block;
  position: relative;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid #fff;
}
</style>

The badge with text

The block with the badge (right-top)
99
The block with the badge (right-top)
99

Click me to view the code
vue
<script setup>
  import { Ui3nBadge } from '@v1nt1248/3nclient-lib'
</script>


<template>
  <ui3n-badge :color="green" value="99" :class="$style.badge">
    <span :class="$style.block">The block with the badge (right-top)</span>
  </ui3n-badge>

  <ui3n-badge value="99" text-color="yellow" color="black" :class="$style.badge">
    <span :class="$style.block">The block with the badge (right-top)</span>
  </ui3n-badge>
</template>

<style lang="scss" module>
.badge {
  margin-bottom: 8px;
}

.block {
  display: block;
  position: relative;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid #fff;
}
</style>