Skip to content

Banner

Banners are usually used to indicate the status or notifications of the entire page. They are typically persistent and require the user to actively close them.

Basic

The default Banner will be displayed full-screen. You can use the to prop to target a specific DOM node.
vue
<template>
  <epp-banner v-model="visible" title="This is Banner" effect="dark" />
  <el-button @click="show">Show/Hide</el-button>
</template>
<script lang="ts" setup>
import { ref } from 'vue';

const visible = ref(false);

const show = () => {
  visible.value = !visible.value;
};
</script>

Targeting a Specific DOM Node

Ensure the DOM node is loaded before the Banner component.

In this example, the Banner component has a delayed load to ensure the DOM container is loaded first.
vue
<template>
  <epp-banner v-if="mounted" v-model="visible" to="#bannerContainer" effect="dark">
    <b>Some Container</b>
  </epp-banner>
  <div
    id="bannerContainer"
    class="m-b-lg"
    style="height: 200px; position: relative; background-color: var(--el-color-primary-light-3)"
  ></div>
  <el-button @click="show">Show/Hide(Delay 1s)</el-button>
</template>
<script lang="ts" setup>
import { ref } from 'vue';

const visible = ref(false);
const mounted = ref(false);

const show = () => {
  mounted.value = true;
  window.setTimeout(() => {
    visible.value = !visible.value;
  }, 1000);
};
</script>

Customization

Example code
vue
<template>
  <epp-banner
    v-model="visible"
    type="success"
    effect="dark"
    dashed
    :closable="false"
    :timeout="5000"
    title="Custom Banner"
  >
    <el-space size="large">
      <el-icon size="20px">
        <GoodsFilled />
      </el-icon>
      <div class="text-regular">
        Read full articles, watch videos, browse thousands of titles and more on the "Home page".
      </div>
    </el-space>
  </epp-banner>
  <el-button @click="show">Show/Hide</el-button>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { GoodsFilled } from '@element-plus/icons-vue';

const visible = ref(false);

const show = () => {
  visible.value = !visible.value;
};
</script>

Attributes

ParameterDescriptionTypeOptional ValuesDefault Value
model-value / v-modelBinding valueboolean
titleTitlestring
typeTypestringsuccess/warning/info/errorinfo
effectStyle themestringlight / darklight
descriptionSupplementary text. Can also be passed through the default slotstring
closableWhether it can be closedbooleantrue
close-textCustom text for the close buttonstring
show-iconWhether to display the iconbooleanfalse
placementPlacementstringtop / bottomtop
animation-nameAnimationstring--
toRendering containerstring-body
z-indexzIndex valuenumber--
heightBanner heightstring--
positionCSS position property setting for the BannerstringValid CSS values like fixed / absolutefixed when to is body, absolute otherwise
timeoutBanner auto-close time, in millisecondsnumber--

Slots

NameDescription
Description
iconCustom icon
titleContent of the title

Events

Event NameDescriptionCallback Parameter
closeTriggered when closing the Banner