<?phpuse Illuminate\Pagination\LengthAwarePaginator;use Livewire\Attributes\Computed;use Livewire\Component;use Livewire\WithPagination;new class extends Component { use WithPagination; #[Computed] public function paginator(): LengthAwarePaginator { return new LengthAwarePaginator(items: $this->subscriptions, total: 11, perPage: 10, currentPage: 1); } #[Computed] public function subscriptions(): array { return [ ['product' => 'ChatGPT Plus', 'logo' => 'chatgpt.svg', 'monochrome' => true, 'category' => 'AI', 'cost' => '$120.00', 'billing' => 'Monthly', 'renewal' => 'Jun 15, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [1, 2, 3, 4], 'more' => 2], ['product' => 'Claude Team', 'logo' => 'claude.svg', 'monochrome' => false, 'category' => 'AI', 'cost' => '$120.00', 'billing' => 'Monthly', 'renewal' => 'Jun 18, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [2, 3, 5, 1], 'more' => 4], ['product' => 'xAI Grok', 'logo' => 'grok.svg', 'monochrome' => true, 'category' => 'AI', 'cost' => '$135.00', 'billing' => 'Monthly', 'renewal' => 'Jun 18, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [1, 2, 3, 6], 'more' => 0], ['product' => 'Planetscale DB', 'logo' => 'planetscale.svg', 'monochrome' => true, 'category' => 'Infrastructure', 'cost' => '$25.00', 'billing' => 'Annual', 'renewal' => 'Jun 19, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [2, 3, 5, 6, 4], 'more' => 0], ['product' => 'Strapi CMS', 'logo' => 'strapi.svg', 'monochrome' => false, 'category' => 'Infrastructure', 'cost' => '$31.00', 'billing' => 'Monthly', 'renewal' => 'Jun 20, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [1, 2, 3, 5], 'more' => 2], ['product' => 'Cloudflare CDN', 'logo' => 'cloudflare.svg', 'monochrome' => false, 'category' => 'Infrastructure', 'cost' => '$313.00', 'billing' => 'Monthly', 'renewal' => 'Jun 22, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [2, 3], 'more' => 0], ['product' => 'Cloudinary', 'logo' => 'cloudinary.svg', 'monochrome' => false, 'category' => 'Infrastructure', 'cost' => '$94.00', 'billing' => 'Monthly', 'renewal' => 'Jun 29, 2026', 'status' => 'Failed', 'status_color' => 'red', 'users' => [1, 2, 3, 6], 'more' => 0], ['product' => 'Mapbox', 'logo' => 'mapbox.svg', 'monochrome' => true, 'category' => 'Infrastructure', 'cost' => '$22.00', 'billing' => 'Monthly', 'renewal' => 'Jun 30, 2026', 'status' => 'Paused', 'status_color' => 'yellow', 'users' => [7], 'more' => 0], ['product' => 'GitHub', 'logo' => 'github.svg', 'monochrome' => true, 'category' => 'DEV Tools', 'cost' => '$40.00', 'billing' => 'Monthly', 'renewal' => 'Jun 30, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [2, 3, 4, 5], 'more' => 3], ['product' => 'Figma', 'logo' => 'figma.svg', 'monochrome' => false, 'category' => 'Other', 'cost' => '$20.00', 'billing' => 'Monthly', 'renewal' => 'Jul 2, 2026', 'status' => 'Active', 'status_color' => 'lime', 'users' => [2, 4], 'more' => 0], ]; } #[Computed] public function users(): array { return [1 => 'Ava Thompson', 2 => 'Liam Carter', 3 => 'Noah Patel', 4 => 'Mia Chen', 5 => 'Ethan Brooks', 6 => 'Sofia Reyes', 7 => 'Lucas Meyer']; }};?>{{-- 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-zinc-50 dark:bg-zinc-900"> <flux:sidebar sticky collapsible="mobile" class="bg-zinc-50 dark:bg-zinc-900"> <flux:sidebar.header> <flux:dropdown class="min-w-0 flex-1"> <flux:sidebar.brand as="button" logo="https://fluxui.dev/img/demos/data-table/loopway.svg" logo:dark="https://fluxui.dev/img/demos/data-table/loopway-dark.svg" name="Acme" alt="Loopway" icon:trailing="chevron-up-down" class="w-full" /> <flux:menu class="min-w-56"> <flux:menu.radio.group> <flux:menu.radio value="acme" checked>Acme</flux:menu.radio> <flux:menu.radio value="globex">Globex</flux:menu.radio> </flux:menu.radio.group> <flux:menu.separator /> <flux:menu.item icon="plus">Add workspace</flux:menu.item> </flux:menu> </flux:dropdown> <flux:sidebar.collapse class="lg:hidden" /> </flux:sidebar.header> <flux:sidebar.nav> <flux:sidebar.item icon="home" href="#">Overview</flux:sidebar.item> <flux:sidebar.item icon="inbox" href="#" current>Subscriptions</flux:sidebar.item> <flux:sidebar.item icon="sparkles" href="#">AI usage</flux:sidebar.item> <flux:sidebar.item icon="code-bracket-square" href="#">API usage</flux:sidebar.item> <flux:sidebar.item icon="arrow-path" href="#">Renewals</flux:sidebar.item> <flux:sidebar.item icon="bell" href="#">Alerts</flux:sidebar.item> <flux:sidebar.item icon="document" href="#">Reports</flux:sidebar.item> <flux:sidebar.item icon="presentation-chart-bar" href="#">Insights</flux:sidebar.item> </flux:sidebar.nav> <flux:sidebar.spacer /> <flux:sidebar.nav> <flux:sidebar.item icon="cog-6-tooth" href="#">Settings</flux:sidebar.item> <flux:sidebar.item icon="information-circle" href="#">Help & support</flux:sidebar.item> </flux:sidebar.nav> <flux:dropdown position="top" align="start"> <flux:sidebar.profile avatar="https://fluxui.dev/img/demos/data-table/max-martin.jpg" name="Max Martin" icon:trailing="chevron-up-down" /> <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="bg-zinc-50 dark:bg-zinc-900"> <flux:sidebar.toggle class="me-2 lg:hidden" icon="bars-2" inset="left" /> <flux:breadcrumbs> <flux:breadcrumbs.item href="#" separator="slash">Acme</flux:breadcrumbs.item> <flux:breadcrumbs.item separator="slash">Subscriptions</flux:breadcrumbs.item> </flux:breadcrumbs> </flux:header> <flux:main inset class="space-y-6"> <flux:heading level="1" class="sr-only">Subscriptions</flux:heading> <flux:tabs scrollable scrollable:scrollbar="hide"> @foreach (['All subscriptions' => 11, 'Active' => 9, 'Expiring soon' => 1, 'Paused' => 1, 'Failed' => 1] as $label => $count) <flux:tab :accent="false" :selected="$loop->first"> {{ $label }} <flux:badge size="sm">{{ $count }}</flux:badge> </flux:tab> @endforeach </flux:tabs> <div class="flex items-center justify-between gap-2"> <flux:input size="sm" variant="filled" icon="magnifying-glass" placeholder="Search subscriptions" aria-label="Search subscriptions" kbd="⌘K" class="sm:max-w-88" /> <div class="flex items-center gap-2"> <flux:dropdown align="end"> <flux:button size="sm" icon="funnel" icon:trailing="chevron-down">Filters</flux:button> <flux:popover class="w-72 space-y-6"> <flux:select variant="listbox" multiple size="sm" label="Category" placeholder="Select categories"> <flux:select.option>AI</flux:select.option> <flux:select.option>Infrastructure</flux:select.option> <flux:select.option>DEV Tools</flux:select.option> <flux:select.option>Other</flux:select.option> </flux:select> <flux:field> <flux:label>Monthly cost</flux:label> <div class="flex items-center gap-2"> <flux:input size="sm" placeholder="$10" aria-label="Minimum monthly cost" /> <flux:text>–</flux:text> <flux:input size="sm" placeholder="$50" aria-label="Maximum monthly cost" /> </div> </flux:field> <flux:checkbox.group label="Billing"> <flux:checkbox label="Monthly" /> <flux:checkbox label="Annual" /> </flux:checkbox.group> <flux:checkbox.group label="Status"> <flux:checkbox label="Active" /> <flux:checkbox label="Paused" /> <flux:checkbox label="Failed" /> </flux:checkbox.group> <div class="grid grid-cols-2 gap-2"> <flux:button size="sm" variant="filled">Clear all</flux:button> <flux:button size="sm" variant="primary">Apply</flux:button> </div> </flux:popover> </flux:dropdown> <flux:button size="sm" variant="primary" icon="plus" class="max-sm:hidden">Add subscription</flux:button> <flux:button size="sm" variant="primary" icon="plus" square aria-label="Add subscription" class="sm:hidden" /> </div> </div> <flux:table :paginate="$this->paginator" aria-label="Subscriptions"> <flux:table.columns> <flux:table.column sortable>Product</flux:table.column> <flux:table.column sortable class="max-md:hidden">Category</flux:table.column> <flux:table.column sortable class="max-sm:hidden">Monthly cost</flux:table.column> <flux:table.column class="max-lg:hidden">Billing</flux:table.column> <flux:table.column sortable sorted direction="asc" class="max-md:hidden">Next renewal</flux:table.column> <flux:table.column sortable>Status</flux:table.column> <flux:table.column class="max-lg:hidden">Assigned users</flux:table.column> <flux:table.column><span class="sr-only">Actions</span></flux:table.column> </flux:table.columns> <flux:table.rows> @foreach ($this->subscriptions as $subscription) <flux:table.row> <flux:table.cell variant="strong"> <div class="flex items-center gap-2"> <div class="flex size-6 shrink-0 items-center justify-center overflow-hidden rounded-md border border-zinc-200 bg-zinc-50 dark:border-white/10 dark:bg-white/10"> <img src="https://fluxui.dev/img/demos/data-table/{{ $subscription['logo'] }}" alt="" @class(['size-6', 'dark:invert' => $subscription['monochrome']])> </div> {{ $subscription['product'] }} </div> </flux:table.cell> <flux:table.cell class="max-md:hidden">{{ $subscription['category'] }}</flux:table.cell> <flux:table.cell variant="strong" class="max-sm:hidden">{{ $subscription['cost'] }}</flux:table.cell> <flux:table.cell class="max-lg:hidden">{{ $subscription['billing'] }}</flux:table.cell> <flux:table.cell class="max-md:hidden">{{ $subscription['renewal'] }}</flux:table.cell> <flux:table.cell> <flux:badge size="sm" :color="$subscription['status_color']" inset="top bottom">{{ $subscription['status'] }}</flux:badge> </flux:table.cell> <flux:table.cell class="max-lg:hidden"> <flux:avatar.group> @foreach ($subscription['users'] as $user) <flux:avatar size="xs" circle tooltip :name="$this->users[$user]" src="https://fluxui.dev/img/demos/data-table/user-{{ $user }}.jpg" /> @endforeach @if ($subscription['more']) <flux:avatar size="xs" circle>+{{ $subscription['more'] }}</flux:avatar> @endif </flux:avatar.group> </flux:table.cell> <flux:table.cell align="end"> <flux:dropdown align="end"> <flux:button variant="ghost" size="sm" icon="ellipsis-horizontal" inset="top bottom" aria-label="Actions for {{ $subscription['product'] }}" /> <flux:menu> <flux:menu.item icon="pencil-square">Edit</flux:menu.item> <flux:menu.item icon="pause">Pause</flux:menu.item> <flux:menu.separator /> <flux:menu.item icon="x-circle" variant="danger">Cancel subscription</flux:menu.item> </flux:menu> </flux:dropdown> </flux:table.cell> </flux:table.row> @endforeach </flux:table.rows> </flux:table> </flux:main></div>