<?phpnew class extends \Livewire\Component { #[\Livewire\Attributes\Computed] public function calendars() { return [ 'team' => ['label' => 'Team', 'color' => 'bg-blue-500'], 'clients' => ['label' => 'Clients', 'color' => 'bg-green-500'], 'design' => ['label' => 'Design', 'color' => 'bg-purple-500'], 'deadline' => ['label' => 'Deadline', 'color' => 'bg-red-500'], 'networking' => ['label' => 'Networking', 'color' => 'bg-sky-500'], ]; } #[\Livewire\Attributes\Computed] public function weeks() { // Each event sits at a day column, spans some days and takes a lane (row) in its week... return [ [ 'days' => [26, 27, 28, 29, 30, 31, 1], 'events' => [ ['title' => 'User interview', 'calendar' => 'clients', 'day' => 6, 'span' => 1, 'lane' => 1], ], ], [ 'days' => [2, 3, 4, 5, 6, 7, 8], 'events' => [ ['title' => 'Weekly team sync', 'calendar' => 'team', 'day' => 2, 'span' => 1, 'lane' => 1], ['title' => 'Design critique', 'calendar' => 'design', 'day' => 3, 'span' => 1, 'lane' => 1], ['title' => 'Client check-in', 'calendar' => 'clients', 'day' => 3, 'span' => 1, 'lane' => 2], ['title' => '1:1 with PM', 'calendar' => 'team', 'day' => 5, 'span' => 1, 'lane' => 1], ], ], [ 'days' => [9, 10, 11, 12, 13, 14, 15], 'events' => [ ['title' => 'Weekly team sync', 'calendar' => 'team', 'day' => 2, 'span' => 1, 'lane' => 1], ['title' => 'Backlog refinement', 'calendar' => 'team', 'day' => 3, 'span' => 1, 'lane' => 1], ['title' => 'Project deadline', 'calendar' => 'deadline', 'day' => 4, 'span' => 1, 'lane' => 1], ['title' => 'Architecture review', 'calendar' => 'team', 'day' => 4, 'span' => 1, 'lane' => 2], ['title' => 'Conference', 'calendar' => 'networking', 'day' => 5, 'span' => 3, 'lane' => 1], ], 'more' => [3 => 3, 5 => 5], ], [ 'days' => [16, 17, 18, 19, 20, 21, 22], 'events' => [ ['title' => 'Conference', 'calendar' => 'networking', 'day' => 1, 'span' => 3, 'lane' => 1], ['title' => 'Weekly team sync', 'calendar' => 'team', 'day' => 2, 'span' => 1, 'lane' => 2], ['title' => 'Design handoff', 'calendar' => 'design', 'day' => 4, 'span' => 1, 'lane' => 1], ], ], [ 'days' => [23, 24, 25, 26, 27, 28, 29], 'events' => [ ['title' => 'Client workshop', 'calendar' => 'clients', 'day' => 2, 'span' => 1, 'lane' => 1], ['title' => 'Weekly team sync', 'calendar' => 'team', 'day' => 2, 'span' => 1, 'lane' => 2], ], ], [ 'days' => [30, 31, 1, 2, 3, 4, 5], 'events' => [], ], ]; } #[\Livewire\Attributes\Computed] public function week() { // Timed events sit in quarter-hour rows from 8 AM, so 9:30 is row 7 and 45 minutes spans 3... return [ ['day' => 'Sun', 'date' => 9, 'allDay' => [], 'events' => []], ['day' => 'Mon', 'date' => 10, 'allDay' => [], 'events' => [ ['title' => 'Weekly team sync', 'time' => '9.30 - 10.15 AM', 'calendar' => 'team', 'row' => 7, 'span' => 3], ]], ['day' => 'Tue', 'date' => 11, 'allDay' => [], 'events' => [ ['title' => 'Backlog refinement', 'time' => '9.30 - 10 AM', 'calendar' => 'team', 'row' => 7, 'span' => 2], ['title' => 'Client workshop', 'time' => '10.30 - 11 AM', 'calendar' => 'clients', 'row' => 11, 'span' => 2], ['title' => 'Design critique', 'time' => '11 - 11.30 AM', 'calendar' => 'design', 'row' => 13, 'span' => 2], ['title' => '1:1 with PM', 'time' => '3 - 3.30 PM', 'calendar' => 'team', 'row' => 29, 'span' => 2], ]], ['day' => 'Wed', 'date' => 12, 'allDay' => [ ['title' => 'Project deadline', 'calendar' => 'deadline', 'span' => 1], ], 'events' => [ ['title' => 'Architecture review', 'time' => '9 - 10 AM', 'calendar' => 'team', 'row' => 5, 'span' => 4], ]], ['day' => 'Thu', 'date' => 13, 'allDay' => [ ['title' => 'Conference', 'calendar' => 'networking', 'span' => 3], ], 'events' => [ ['title' => 'Partner meeting', 'time' => '9 - 10.45 AM', 'calendar' => 'clients', 'row' => 5, 'span' => 7], ['title' => '1:1 with PM', 'time' => '11 - 11.30 AM', 'calendar' => 'team', 'row' => 13, 'span' => 2], ['title' => 'Checkout flow planning', 'time' => '12 - 12.30 PM', 'calendar' => 'design', 'row' => 17, 'span' => 2, 'class' => 'w-1/3 justify-self-start'], ['title' => 'Q4 roadmap planning', 'time' => '12 - 1.30 PM', 'calendar' => 'team', 'row' => 17, 'span' => 6, 'class' => 'w-1/3 justify-self-center'], ['title' => 'Client sync', 'time' => '12.15 - 1 PM', 'calendar' => 'clients', 'row' => 18, 'span' => 3, 'class' => 'w-1/3 justify-self-end'], ]], ['day' => 'Fri', 'date' => 14, 'allDay' => [], 'events' => []], ['day' => 'Sat', 'date' => 15, 'allDay' => [], 'events' => []], ]; } #[\Livewire\Attributes\Computed] public function agenda() { return [ 'Monday, Aug 10' => [ ['title' => 'Weekly team sync', 'time' => '9.30 - 10.15 AM', 'calendar' => 'team', 'location' => 'Google Meet', 'people' => 7], ], 'Tuesday, Aug 11' => [ ['title' => 'Backlog refinement', 'time' => '9.30 - 10 AM', 'calendar' => 'team', 'location' => 'Meeting Room 1', 'people' => 6], ['title' => 'Client workshop', 'time' => '10.30 - 11 AM', 'calendar' => 'clients', 'location' => 'Zoom', 'people' => 6], ['title' => 'Design critique', 'time' => '11 - 11.30 AM', 'calendar' => 'design', 'location' => 'Google Meet', 'people' => 3], ['title' => '1:1 with PM', 'time' => '3 - 3.30 PM', 'calendar' => 'team', 'location' => 'Huddle room 12A', 'people' => 2], ], 'Wednesday, Aug 12' => [ ['title' => 'Project deadline', 'time' => 'All day', 'calendar' => 'deadline', 'location' => null, 'people' => 0], ['title' => 'Architecture review', 'time' => '9 - 10 AM', 'calendar' => 'team', 'location' => 'Meeting Room 2', 'people' => 6], ], 'Thursday, Aug 13' => [ ['title' => 'Conference', 'time' => 'All day', 'calendar' => 'networking', 'location' => 'Conference Center', 'people' => 6], ['title' => 'Partner meeting', 'time' => '9 - 10.45 AM', 'calendar' => 'clients', 'location' => 'Boardroom', 'people' => 6], ['title' => '1:1 with PM', 'time' => '11 - 11.30 AM', 'calendar' => 'team', 'location' => 'Huddle room 12A', 'people' => 2], ['title' => 'Checkout flow planning', 'time' => '12 - 12.30 PM', 'calendar' => 'design', 'location' => 'Google Meet', 'people' => 2], ['title' => 'Q4 roadmap planning', 'time' => '12 - 1.30 PM', 'calendar' => 'team', 'location' => 'Workshop Room', 'people' => 6], ['title' => 'Client sync', 'time' => '12.15 - 1 PM', 'calendar' => 'clients', 'location' => 'Google Meet', 'people' => 2], ], ]; } #[\Livewire\Attributes\Computed] public function people() { return [ 'https://fluxui.dev/img/demos/calendar/sofia-rossi.jpg', 'https://fluxui.dev/img/demos/calendar/emma-wilson.jpg', 'https://fluxui.dev/img/demos/calendar/liam-carter.jpg', ]; }};?>{{-- This standalone demo keeps its application shell inline. In a production app, move shared navigation into your app layout. --}}<div class="min-h-dvh bg-white dark:bg-zinc-900"> <flux:sidebar sticky collapsible="mobile" class="w-14 px-2 border-e border-zinc-200 bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900"> <flux:sidebar.brand href="#" logo="https://fluxui.dev/img/demos/calendar/logo.svg" logo:dark="https://fluxui.dev/img/demos/calendar/logo-dark.svg" alt="Calendar" /> <flux:sidebar.nav> <flux:sidebar.item icon="calendar-days" href="#" current :accent="false" aria-label="Calendar" /> <flux:sidebar.item icon="list-bullet" href="#" aria-label="Tasks" /> <flux:sidebar.item icon="clock" href="#" aria-label="Availability" /> <flux:sidebar.item icon="rectangle-stack" href="#" aria-label="Templates" /> <flux:sidebar.item icon="users" href="#" aria-label="Contacts" /> <flux:sidebar.item icon="link" href="#" aria-label="Booking links" /> </flux:sidebar.nav> <flux:sidebar.spacer /> <flux:sidebar.nav> <flux:sidebar.item icon="bell" href="#" aria-label="Notifications" /> <flux:sidebar.item icon="cog-6-tooth" href="#" aria-label="Settings" /> </flux:sidebar.nav> <flux:dropdown position="top" align="start"> <flux:avatar as="button" size="sm" circle src="https://fluxui.dev/img/demos/calendar/daniel-novak.jpg" name="Daniel Novak" /> <flux:menu> <flux:menu.item icon="user">Profile</flux:menu.item> <flux:menu.item icon="arrow-right-start-on-rectangle">Logout</flux:menu.item> </flux:menu> </flux:dropdown> </flux:sidebar> <flux:header class="gap-2 border-b border-zinc-200 dark:border-zinc-700"> <flux:sidebar.toggle class="lg:hidden" icon="bars-2" inset="left" /> <flux:brand href="#" logo="https://fluxui.dev/img/demos/calendar/logo.svg" logo:dark="https://fluxui.dev/img/demos/calendar/logo-dark.svg" alt="Calendar" class="lg:hidden" /> <flux:spacer /> <flux:button size="sm" icon="share">Share</flux:button> <flux:button size="sm" variant="primary" icon="plus">New event</flux:button> </flux:header> <flux:main> <flux:heading level="1" class="sr-only">Calendar</flux:heading> <flux:tab.group> <div class="flex flex-wrap items-center justify-between gap-4 sm:grid sm:grid-cols-3"> <div class="flex items-center gap-2"> <flux:button size="sm" icon="chevron-left" aria-label="Previous" /> <flux:button size="sm" icon="chevron-right" aria-label="Next" /> <flux:button size="sm" class="max-sm:hidden">Today</flux:button> </div> <flux:dropdown align="center" class="sm:justify-self-center"> <flux:button variant="ghost" icon:trailing="chevron-down">August 2026</flux:button> <flux:menu> <flux:menu.radio.group> <flux:menu.radio>July 2026</flux:menu.radio> <flux:menu.radio checked>August 2026</flux:menu.radio> <flux:menu.radio>September 2026</flux:menu.radio> </flux:menu.radio.group> </flux:menu> </flux:dropdown> <flux:tabs variant="segmented" class="max-sm:w-full sm:justify-self-end"> <flux:tab name="month">Month</flux:tab> <flux:tab name="week">Week</flux:tab> <flux:tab name="day">Day</flux:tab> <flux:tab name="list">List</flux:tab> </flux:tabs> </div> <flux:tab.panel name="month"> <div class="overflow-hidden rounded-xl border border-zinc-200 dark:border-zinc-700"> <div class="grid grid-cols-7 divide-x divide-zinc-200 border-b border-zinc-200 bg-zinc-50 dark:divide-zinc-700 dark:border-zinc-700 dark:bg-zinc-800"> @foreach (['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $day) <div class="py-2 text-center text-sm font-medium text-zinc-800 dark:text-white"> <span class="sm:hidden">{{ $day[0] }}</span> <span class="max-sm:hidden">{{ $day }}</span> </div> @endforeach </div> @foreach ($this->weeks as $week) <div class="relative border-b border-zinc-200 last:border-b-0 dark:border-zinc-700"> <div class="grid grid-cols-7 divide-x divide-zinc-200 dark:divide-zinc-700"> @foreach ($week['days'] as $day) {{-- Days from July and September are greyed out, and today is the 10th... --}} @php $outside = ($loop->parent->first && $day > 7) || ($loop->parent->last && $day < 7) @endphp <div @class([ 'min-h-24 p-2 text-center text-sm font-medium', 'bg-zinc-50 dark:bg-white/5' => $day === 10, 'text-zinc-400 dark:text-zinc-500' => $outside, 'text-zinc-800 dark:text-white' => ! $outside, ])>{{ $day }}</div> @endforeach </div> {{-- Events lie on top of the days, in a grid of their own... --}} <div class="absolute inset-x-0 top-9 grid grid-cols-7 gap-y-1"> @foreach ($week['events'] as $event) <div class="mx-0.5 truncate rounded-md px-1 py-0.5 text-xs sm:mx-1 sm:px-1.5 font-medium text-white {{ $this->calendars[$event['calendar']]['color'] }}" style="grid-column: {{ $event['day'] }} / span {{ $event['span'] }}; grid-row: {{ $event['lane'] }}" >{{ $event['title'] }}</div> @endforeach @foreach ($week['more'] ?? [] as $day => $count) <div class="py-0.5 text-center text-xs font-medium text-zinc-800 dark:text-white" style="grid-column: {{ $day }}; grid-row: 2"> +{{ $count }}<span class="max-sm:hidden"> more</span> </div> @endforeach </div> </div> @endforeach </div> </flux:tab.panel> {{-- Week and day share one hour grid, the day view showing only Thursday... --}} @foreach (['week' => $this->week, 'day' => [$this->week[4]]] as $view => $days) <flux:tab.panel :name="$view"> <div class="overflow-hidden rounded-xl border border-zinc-200 dark:border-zinc-700"> <div class="flex border-b border-zinc-200 bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-800"> <div class="w-14 shrink-0 border-e border-zinc-200 sm:w-16 dark:border-zinc-700"></div> <div @class(['grid flex-1 divide-x divide-zinc-200 dark:divide-zinc-700', 'grid-cols-7' => $view === 'week'])> @foreach ($days as $day) <div class="py-2 text-center text-sm font-medium text-zinc-800 dark:text-white"> <span class="text-zinc-500 max-sm:block dark:text-zinc-400">{{ $day['day'] }}</span> {{ $day['date'] }} </div> @endforeach </div> </div> <div class="flex border-b border-zinc-200 dark:border-zinc-700"> <div class="w-14 shrink-0 border-e border-zinc-200 px-2 py-3 text-xs text-zinc-500 sm:w-16 dark:border-zinc-700 dark:text-zinc-400">All day</div> <div @class(['grid flex-1 gap-y-1 p-1', 'grid-cols-7' => $view === 'week'])> @foreach ($days as $day) @foreach ($day['allDay'] as $event) {{-- A bar can't run past the last day in view... --}} <div class="mx-0.5 truncate rounded-md px-1.5 py-1 text-xs font-medium text-white {{ $this->calendars[$event['calendar']]['color'] }}" style="grid-column: {{ $loop->parent->iteration }} / span {{ min($event['span'], $loop->parent->remaining + 1) }}" >{{ $event['title'] }}</div> @endforeach @endforeach </div> </div> <div class="flex"> <div class="w-14 shrink-0 divide-y divide-zinc-200 border-e border-zinc-200 sm:w-16 dark:divide-zinc-700 dark:border-zinc-700"> @foreach (['8 AM', '9 AM', '10 AM', '11 AM', '12 PM', '1 PM', '2 PM', '3 PM', '4 PM', '5 PM'] as $hour) <div class="h-20 px-2 py-1 text-xs text-zinc-500 dark:text-zinc-400">{{ $hour }}</div> @endforeach </div> <div @class(['grid flex-1 divide-x divide-zinc-200 dark:divide-zinc-700', 'grid-cols-7' => $view === 'week'])> @foreach ($days as $day) <div @class(['relative min-w-0', 'bg-zinc-50 dark:bg-white/5' => $day['date'] === 10])> <div class="divide-y divide-zinc-200 dark:divide-zinc-700"> @foreach (range(1, 10) as $hour) <div class="h-20"></div> @endforeach </div> <div class="absolute inset-0 grid grid-cols-1 grid-rows-40"> @foreach ($day['events'] as $event) <div @class(['col-start-1 m-0.5 overflow-hidden rounded-md p-1 text-xs font-medium text-white', $this->calendars[$event['calendar']]['color'], $event['class'] ?? null]) style="grid-row: {{ $event['row'] }} / span {{ $event['span'] }}" > <p class="truncate">{{ $event['title'] }}</p> @if ($event['span'] > 2) <p class="truncate opacity-80 max-sm:hidden">{{ $event['time'] }}</p> @endif </div> @endforeach </div> </div> @endforeach </div> </div> </div> </flux:tab.panel> @endforeach <flux:tab.panel name="list"> <flux:table> @foreach ($this->agenda as $date => $events) <flux:table.rows> <flux:table.row> <flux:table.cell colspan="5" variant="strong">{{ $date }}</flux:table.cell> </flux:table.row> @foreach ($events as $event) <flux:table.row> <flux:table.cell class="w-36">{{ $event['time'] }}</flux:table.cell> <flux:table.cell variant="strong" class="w-full max-w-0"> <div class="flex items-center gap-2"> <span class="size-2 shrink-0 rounded-full {{ $this->calendars[$event['calendar']]['color'] }}"></span> <span class="truncate">{{ $event['title'] }}</span> </div> </flux:table.cell> <flux:table.cell class="max-md:hidden">{{ $event['location'] ?? '—' }}</flux:table.cell> <flux:table.cell class="max-lg:hidden"> @if ($event['people']) <flux:avatar.group> @foreach (array_slice($this->people, 0, $event['people']) as $photo) <flux:avatar size="xs" circle :src="$photo" /> @endforeach @if ($event['people'] > 3) <flux:avatar size="xs" circle>+{{ $event['people'] - 3 }}</flux:avatar> @endif </flux:avatar.group> @endif </flux:table.cell> <flux:table.cell> <flux:dropdown align="end"> <flux:button size="sm" variant="ghost" icon="ellipsis-horizontal" inset="top bottom" aria-label="Actions" /> <flux:menu> <flux:menu.item icon="pencil-square">Edit</flux:menu.item> <flux:menu.item icon="document-duplicate">Duplicate</flux:menu.item> <flux:menu.separator /> <flux:menu.item icon="trash" variant="danger">Delete</flux:menu.item> </flux:menu> </flux:dropdown> </flux:table.cell> </flux:table.row> @endforeach </flux:table.rows> @endforeach </flux:table> </flux:tab.panel> </flux:tab.group> </flux:main></div>