Position in Vue Appbar component

11 Jun 202416 minutes to read

The position of the AppBar can be set using the position and isSticky property. The AppBar provides the following options for setting its position:

  • Top AppBar
  • Bottom AppBar
  • Sticky AppBar

Top AppBar

The top AppBar is the default one in which it positions the AppBar at the top of the content.

<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script setup>
import { AppBarComponent as EjsAppbar } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent as EjsButton } from "@syncfusion/ej2-vue-buttons";
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 220px;
  margin: 0 auto;
  width: 500px;
  overflow-y: scroll;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>
<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script>

import { AppBarComponent } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent } from "@syncfusion/ej2-vue-buttons";

export default {
  name: "App",
  components: {
    "ejs-appbar": AppBarComponent,
    "ejs-button": ButtonComponent
  },
  data: function () {
    return {};
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 220px;
  margin: 0 auto;
  width: 500px;
  overflow-y: scroll;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>

Bottom AppBar

This position can be set to the AppBar by setting Bottom to the property position. The bottom AppBar positions the AppBar at the bottom of the content.

<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary" position="Bottom">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script setup>
import { AppBarComponent as EjsAppbar } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent as EjsButton } from "@syncfusion/ej2-vue-buttons";
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 300px;
  width: 500px;
  margin: 0 auto;
  position: relative;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>
<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary" position="Bottom">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script>

import { AppBarComponent } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent } from "@syncfusion/ej2-vue-buttons";

export default {
  name: "App",
  components: {
    "ejs-appbar": AppBarComponent,
    "ejs-button": ButtonComponent
  },
  data: function () {
    return {};
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 300px;
  width: 500px;
  margin: 0 auto;
  position: relative;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>

Sticky AppBar

This position can be set to the AppBar by setting true to the property isSticky. AppBar will be sticky while scrolling the AppBar content.

<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary" :isSticky="true">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script setup>

import { AppBarComponent as EjsAppbar } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent as EjsButton } from "@syncfusion/ej2-vue-buttons";

</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 220px;
  margin: 0 auto;
  width: 500px;
  overflow-y: scroll;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>
<template>
  <div class="control-container">
    <ejs-appbar colorMode="Primary" :isSticky="true">
      <ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></ejs-button>
      <div class="e-appbar-spacer"></div>
      <ejs-button cssClass="e-inherit">FREE TRIAL</ejs-button>
    </ejs-appbar>
    <div class="appbar-content" style="font-size: 12px">
      <p>
        The AppBar also known as action bar or nav bar displays information and actions related to the current
        application screen. It is used to show branding, screen titles, navigation, and actions. The control supports
        height mode, color mode, positioning, and more.
      </p>
      <p>
        The AppBar control provides flexible ways to configure the look and feel of the bar to match your requirement.
      </p>
      <p>
        Developers can control the appearance and behaviors of the AppBar using a rich set of APIs.
      </p>
      <p>
        The AppBar component supports built-in themes such as Material, Bootstrap, Fabric (Office 365), Tailwind CSS,
        and high contrast. Users can customize these built-in themes or create new themes to achieve their desired look
        and feel by either simply overriding SASS variables or using our Theme Studio application.
      </p>
    </div>
  </div>
</template>

<script>

import { AppBarComponent } from "@syncfusion/ej2-vue-navigations";
import { ButtonComponent } from "@syncfusion/ej2-vue-buttons";

export default {
  name: "App",
  components: {
    "ejs-appbar": AppBarComponent,
    "ejs-button": ButtonComponent
  },
  data: function () {
    return {};
  }
};
</script>

<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

.control-container {
  height: 220px;
  margin: 0 auto;
  width: 500px;
  overflow-y: scroll;
}

.control-container .e-btn.e-inherit {
  margin: 0 3px;
}
</style>