New to Telerik UI for Blazor? Download Free 30-day trial
Scheduler - Templates
- EXAMPLE
- VIEW SOURCE
- EDIT IN TELERIK REPL
- Change Theme
default
Grouped
Design
Development
PM05-10
05-10
05-10
- Templates.razor
- MeetingService.cs
- MeetingDto.cs
Description
The Telerik Blazor Scheduler component exposes a variety of templates that allow you to customize the rendering of its inner elements.
Appointment Templates
By default, only the Title of the appointment is shown in each event, and you can change that through the ItemTemplate and AllDayItemTemplate. You can set that content for the entire Scheduler so all appointments use it, or you can set or override it per view. For example, you could have the Week and Multi-day views render the appointments one way, but the Day or Month views to use different templates.
You can use those templates to display more content - such as the start and end time, icons, customized action buttons, and so on. You can add that content conditionally based on the application logic and apply the required styling. Since this is a Blazor app, you have access to the view-model data, so you can write more complex logic that takes into account component settings such as slot duration, component size, number of days, current date, and so on.
Moreover, you can add a CSS class to the entire appointment conditionally through the OnItemRender event. This lets you cascade through it and style the entire element, not just your content. This can be useful for making certain appointments use a given color that is not the default.
Header Templates
The Scheduler exposes a DateHeaderTemplate that you can use to customize the rendering of the Scheduler date header cells. The DateHeaderTemplate is declared on view level and you can add different content in the header templates for the separate views.
When the Scheduler is grouped by a resource, you can use the ResourceGroupHeaderTemplate to customize the rendering of the group headers. You can declare the ResourceGroupHeaderTemplate on root component level to have the same group header content for each view. Or, you can define the template in each view if you want to add different content.
Slot Templates
The views of the Scheduler expose SlotTemplate configuration that allows for adding arbitrary content to the slot cells. It can be used in conjunction with the OnCellRender event to utilize full control over the appearance of the Scheduler's content. The slot templates are defined on view level and you can add different content in the slot templates for the separate views.