By default, the JavaScript Calendar fills the available width of a block-level host. Set width to size it explicitly, or size the containing element with CSS to let it follow the layout.
Use a number such as 800 for pixels or a CSS string such as "800px" or "80%". Numeric widths are supported in Pro since 2026.4.7172 and in Lite since 2026.4.902.
Set the value during initialization or change it with update after the component is displayed.
To control the width of individual time-grid columns, see Responsive Column Width.
Set the Calendar width
JavaScript
const calendar = new DayPilot.Calendar("dp", {width: 800});
calendar.init();
// Fill the container when switching to the flexible layout.
calendar.update({width: "100%"});Angular
<daypilot-calendar [config]="config"></daypilot-calendar>config: DayPilot.CalendarConfig = {
width: 800
};React
<DayPilotCalendar width={800} />Vue
<DayPilotCalendar :width="800" />ASP.NET WebForms
<DayPilot:DayPilotCalendar
runat="server"
id="DayPilotCalendar1"
Width="100%"
...
/>ASP.NET MVC
@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig {
BackendUrl = ResolveUrl("~/Calendar/Backend"),
Width = "100%",
...
})
Java
<div id="dpc"></div>
<script type="text/javascript">
var dpc = new DayPilot.Calendar("dpc");
dpc.backendUrl = "${pageContext.request.contextPath}/dpc";
dpc.width = "100%";
// ...
dpc.init();
</script>
Availability
Availability of this feature in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript | ||
| DayPilot for ASP.NET WebForms | ||
| DayPilot for ASP.NET MVC | ||
| DayPilot for Java |
DayPilot