Variable Event Height

By default, events are equal in height and content is truncated by default where necessary. There are cases however where event height should match the content so that everything fits. To render events with variable height, use the eventHeight: 'variable' property under the view option's timeline configuration and the custom event templates: timelineEvent or timelineEventContent . When the latter is used, to let the event container grow, the height of the inner content must be set to auto: .mbsc-schedule-event-inner { height: auto }. The height of the timeline events grow with the internal content, and the height of the resource rows adjust themselves to the events.

In the following example the height of the resource rows change dynamically based on the height of their events. Resources are the rooms where events are held and events have varying descriptions.

Variable event height is an experimental feature.  Learn more about it in the documentation →
Get started with this example

Demo

Loading the live demo

Preview in full screen

Show Timeline events sized to content — resource rows grow to fit the tallest event, keeping text visible in room or resource schedules.

Code

<script setup>
import { getJson, MbscEventcalendar  } from '@mobiscroll/vue'
import { onMounted, ref } from 'vue'

const myEvents = ref([])

const myView = {
  timeline: {
    type: 'week',
    eventHeight: 'variable',
    startTime: '07:00',
    endTime: '21:00'
  }
}

const myResources = ref([
  {
    id: 1,
    name: 'Franklin Hall',
    color: '#e20000'
  },
  {
    id: 2,
    name: 'Jefferson Commons',
    color: '#76e083'
  },
  {
    id: 3,
    name: 'Lincoln Residence',
    color: '#4981d6'
  },
  {
    id: 4,
    name: 'Roosevelt House',
    color: '#e25dd2'
  },
  {
    id: 5,
    name: 'Adams Hall',
    color: '#f7961e'
  },
  {
    id: 6,
    name: 'Washington Tower',
    color: '#d6d145'
  }
])

onMounted(() => {
  getJson(
    'https://trial.mobiscroll.com/events-variable-height/',
    (events) => {
      myEvents.value = events
    },
    'jsonp'
  )
})
</script>

<template>
  <MbscEventcalendar
    :view="myView"
    :data="myEvents"
    :resources="myResources"
    :dragToCreate="false"
    :clickToCreate="false"
    :dragToMove="true"
    :dragToResize="true"
    :dragInTime="true"
  >
    <template #timelineEventContent="event">
      <div class="mds-variable-event-height-title">{{ event.title }}</div>
      <div class="mds-variable-event-height-description">{{ event.original.description }}</div>
    </template>
  </MbscEventcalendar>
</template>

<style>
.mds-variable-event-height-title {
  white-space: normal;
  line-height: 16px;
  font-size: 15px;
  font-weight: 600;
}

.mds-variable-event-height-description {
  padding: 8px 0;
  white-space: normal;
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
}

.mds-variable-event-height .mbsc-schedule-event-range {
  font-size: 12px;
  font-weight: 600;
}

.mds-variable-event-height .mbsc-schedule-event-inner {
  padding: 1em;
}
</style>

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.