---
title: "Vue Date & Time Understanding display modes Example | Mobiscroll"
component: "Date & Time"
framework: "Vue"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/vue/datetime/mobile-desktop-display"
---

# Understanding display modes - Vue Date & Time demo

Embeddable Vue date time picker for mobile and desktop with top, bottom, popup, center, modal, anchored positioning. For Vue and Nuxt.

- [Live demo](https://demo.mobiscroll.com/vue/datetime/mobile-desktop-display)
- [View SFC JS code on GitHub](https://github.com/acidb/mobiscroll-demos-vue/tree/main/src/demos/datepicker/datetime/mobile-desktop-display)
- [View SFC TS code on GitHub](https://github.com/acidb/mobiscroll-demos-vue-ts/tree/main/src/demos/datepicker/datetime/mobile-desktop-display)
- This demo in other frameworks: [JavaScript](https://demo.mobiscroll.com/javascript/datetime/mobile-desktop-display.md), [jQuery](https://demo.mobiscroll.com/jquery/datetime/mobile-desktop-display.md), [Angular](https://demo.mobiscroll.com/angular/datetime/mobile-desktop-display.md), [React](https://demo.mobiscroll.com/react/datetime/mobile-desktop-display.md)

## Description

The date picker has five built-in display modes that can be controlled through the [`display` option](https://mobiscroll.com/docs/vue/datepicker/api#opt-display):

- `top` - modal that slides down from the top
- `bottom` - modal that slides up from the bottom
- `center` - modal that shows up in the middle with a pop animation
- `anchored` - modal that shows up anchored to an input or any dom element
- `inline` - embeddable picker that is rendered into the markup without its own modal

Use the [`touchUi` option](https://mobiscroll.com/docs/vue/datepicker/api#opt-touchUi) to switch between touch optimized mobile rendering and pointer optimized desktop rendering. It can be dynamically switched with the help of the `responsive` option.

The defaults change on a theme to theme basis. The `ios` theme comes with `bottom` on mobile and `anchored` on desktop while the `material` and `windows` themes have `center` on mobile and `anchored` on desktop.

**Want to see how to set up responsiveness?** [Check out the previous example →](https://demo.mobiscroll.com/vue/datetime/responsive)

## What this demo shows

- Shows five wheel-style date pickers demonstrate single-date selection with the supported display modes.
- **Inline date picker** The inline example embeds the date picker directly in the page without an input or modal.
- **Anchored date picker** The anchored example opens from an input and positions the picker next to that input or another DOM element.
- **Top date picker** The top example opens in a modal that slides down from the top.
- **Bottom date picker** The bottom example opens in a modal that slides up from the bottom.
- **Center date picker** The center example opens in the middle of the viewport with a pop animation.
- **Modal behavior** Focusing or clicking an input opens its picker, while clicking outside the picker closes it.
- **Date selection** Separate scrollable wheels let users select the month, day, and year. The selected values appear in a central selection area, while neighboring values remain visually subdued.
- **Scrolling behavior** Users can scroll vertically through neighboring values to move between dates, including dates in other months or years.
- **Footer actions** In the input-based examples, the gray `Cancel` button discards the change, while the blue `Set` button confirms the selected date.
- **Input value** In the input-based examples, confirming a date with `Set` displays the selected value in the input using a month, day, and year format.

## Best for

- **Inline layouts** Keep the date picker visible in booking flows, forms, dashboards, or side panels where users need direct access to date selection.
- **Anchored desktop forms** Open the picker next to an input or another page element when the surrounding form should remain visible.
- **Top-aligned mobile flows** Use a modal that enters from the top when the date picker should follow a top-oriented mobile layout.
- **Bottom-aligned mobile flows** Use a modal that enters from the bottom for touch-oriented interfaces and bottom-sheet interaction patterns.
- **Focused modal tasks** Center the picker when date selection should appear as a distinct task in the middle of the viewport.

## Tutorial

```vue
<MbscDatepicker
  display="inline"
  :touchUi="true"
/>
```

```vue
<MbscDatepicker
  display="anchored"
  :touchUi="true"
/>
```

```vue
<MbscDatepicker
  display="top"
  :touchUi="true"
/>
```

```vue
<MbscDatepicker
  display="bottom"
  :touchUi="true"
/>
```

```vue
<MbscDatepicker
  display="center"
  :touchUi="true"
/>
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/vue/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/vue/datepicker/api#opt-themeVariant) - option
- [`controls`](https://mobiscroll.com/docs/vue/datepicker/api#opt-controls) - option
- [`display`](https://mobiscroll.com/docs/vue/datepicker/api#opt-display) - option
- [`inputStyle`](https://mobiscroll.com/docs/vue/datepicker/api#opt-inputStyle) - option
- [`labelStyle`](https://mobiscroll.com/docs/vue/datepicker/api#opt-labelStyle) - option

## Code

### SFC JS

```vue
<script setup>
import { MbscDatepicker, MbscPage, setOptions } from '@mobiscroll/vue'

setOptions({
  theme: 'ios',
  themeVariant: 'light'
})
</script>

<template>
  <MbscPage>
    <MbscDatepicker :controls="['date']" display="inline" />
    <MbscDatepicker
      :controls="['date']"
      display="anchored"
      label="Anchored"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="top"
      label="Top"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="bottom"
      label="Bottom"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="center"
      label="Center"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
  </MbscPage>
</template>
```

### SFC TS

```vue
<script setup lang="ts">
import { MbscDatepicker, MbscPage, setOptions } from '@mobiscroll/vue'

setOptions({
  theme: 'ios',
  themeVariant: 'light'
})
</script>

<template>
  <MbscPage>
    <MbscDatepicker :controls="['date']" display="inline" />
    <MbscDatepicker
      :controls="['date']"
      display="anchored"
      label="Anchored"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="top"
      label="Top"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="bottom"
      label="Bottom"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
    <MbscDatepicker
      :controls="['date']"
      display="center"
      label="Center"
      inputStyle="outline"
      labelStyle="stacked"
      placeholder="Please Select..."
    />
  </MbscPage>
</template>
```

## Implementation notes

- Use `controls: ['date']` (wheel-style, not the month-grid `calendar` control) with `display` set to `'inline'` (embedded, no popup), `'anchored'` (opens next to the input), `'top'` (modal entering from the top), `'bottom'` (modal entering from the bottom), or `'center'` (centered modal) - five separate `Datepicker` instances, one per mode.
- `'inline'` mode has no popup/modal semantics - it's always embedded directly in the page; the other four values all render as a popup relative to an associated input.
- The four input-based examples set `label`, `labelStyle: 'stacked'`, `inputStyle: 'outline'`, and `placeholder` on the input to render a stacked-label, outline-style field; the `inline` example has no associated input.
- `touchUi` (true by default on touch devices) determines whether the picker renders as scroller wheels (`true`) or dropdowns/desktop rendering (`false`).

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-vue.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll - open a terminal window in the root directory and run:

   ```
   mobiscroll config vue
   ```

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config vue --trial`.

Running a demo locally requires a Mobiscroll trial or a license; setup is per framework at https://mobiscroll.com/docs/vue/getting-started/installation

## Related demos

- Previous: [Responsive behavior](https://demo.mobiscroll.com/vue/datetime/responsive.md) - Responsive Vue date time picker. Define how it shows up across multiple screen sizes for touch and mouse interaction.
