// DOCS CALENDAR 3.x

Configuring resources

The CalendarResource object is a fluent wrapper around the resource object of the underlying calendar package. This page goes through the available methods.

ID

Every resource needs a unique ID, which you pass to make. This is the ID your events reference through resourceId:

CalendarResource::make('room-1');

Title

Sets the label that is rendered for the resource:

CalendarResource::make('room-1')->title('Room 1');

To output HTML, pass a HtmlString or any other Htmlable.

Event colors

You can set default colors for all events of a resource:

CalendarResource::make('room-1')
    ->eventBackgroundColor('#ff0000')
    ->eventTextColor('#ffffff');

Colors set on an event itself take precedence.

Nested resources

Resources can have children, which renders them as a collapsible group in the timeline views:

CalendarResource::make('building-a')
    ->title('Building A')
    ->children([
        CalendarResource::make('room-1')->title('Room 1'),
        CalendarResource::make('room-2')->title('Room 2'),
    ]);

You can also add them one by one with child().

Custom data

Just like events, resources accept any custom data via extendedProps, which you can use in custom label content:

CalendarResource::make('room-1')
    ->extendedProp('foo', 'bar')
    // or
    ->extendedProps(['baz' => 'qux']);
guava/calendar 417K installs · 310 stars
// COOKIES

A few cookies keep the site working; others remember preferences or count visits. You choose what runs.

Cookie policy