Giter Club home page Giter Club logo

blazorfullcalendar's Introduction

BlazorFullCalendar

This is a (fully functional, but as of yet partially implemented) Blazor wrapper for the excellent https://fullcalendar.io/ javascript calendar.

image

Getting started

Currently there is no Nuget package yet, so you need to include the project into your own Blazor solution.

In you _Host.cshtml load the required fullcalendar scripts. You probably don't need all of them, depending on what functions you want to use. Refer to the fullcalendar documentation for this please.

<link href='https://unpkg.com/@@fullcalendar/core@@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@@fullcalendar/daygrid@@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@@fullcalendar/timegrid@@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@@fullcalendar/timeline@@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@@fullcalendar/resource-timeline@@4.4.0/main.min.css' rel='stylesheet' />

<script src="https://unpkg.com/@@fullcalendar/bootstrap@@4.4.0/main.min.js"></script>
<script src='https://unpkg.com/@@fullcalendar/core@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/interaction@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/daygrid@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/timegrid@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/timeline@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/resource-common@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/resource-timeline@@4.4.0/main.min.js'></script>
<script src='https://unpkg.com/@@fullcalendar/google-calendar@@4.4.0/main.min.js'></script>

Also in you _Host.cshtml add this line to load the custom frontend interop scripts:

<script src="_content/BlazorFullCalendar/BlazorFullCalendar.js"></script>

There is nothing else to be done server-side.

The simplest way to implement the calendar is like this:

<FullCalendar settings="@calendarSettings" />

@code {
    public CalendarSettings calendarSettings { get; set; }  = new CalendarSettings()
    {
        plugins = new[] { CalendarPluginTypes.DayGrid, CalendarPluginTypes.Interaction },
        defaultView = "dayGridWeek",
        timeZone = "UTC",
        eventSources = new List<CalendarSourceFeed>()
        {
            new CalendarSourceFeed() { url = "https://fullcalendar.io/demo-events.json", extraParams = new Dictionary<string, string>(){ { "custom","dummy"} } }
        }
    };
}

Basically what you do is put a FullCalendar component on your Razor page and then pass a CalendarSettings object to the component. CalendarSettings (and the associated CalendarViews etc) can get pretty complex. Have a look at the sample pages. I tried to stay close to the way the javascript configuration works.

Many, but by far not every possible option is implemented yet. If you're missing some option, it should be trivial to add (or just open an Issue and I'll see when I get around to add it).

Currently this release works with v4 of FullCalendar. As I understand it, v5 is around the corner and I plan to support it as well, once it goes live (and stable).

blazorfullcalendar's People

Contributors

flipswitchingmonkey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.