© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
3 replies
umardi_

Add Action Button on Topbar

I tried to add cart button next to the notification icon on topbar. But it didn't work. No modal opens when I clicked it.
Here is the code in AppPanelProvider.php

->renderHook(
                PanelsRenderHook::GLOBAL_SEARCH_AFTER,
                function () {
                    $action = Action::make('cartAction')
                        ->label('')
                        ->icon('heroicon-o-shopping-cart')
                        ->iconSize('lg')
                        ->color('gray')
                        ->iconButton()
                        ->slideOver()
                        ->form([
                            TextInput::make('subject'),
                        ])
                        ->action(function (array $data) {
                            // Handle the action logic here
                            dd($data);
                            
                        });

                    return view('components.add-cart-button', compact('action'));
                }
            )
->renderHook(
                PanelsRenderHook::GLOBAL_SEARCH_AFTER,
                function () {
                    $action = Action::make('cartAction')
                        ->label('')
                        ->icon('heroicon-o-shopping-cart')
                        ->iconSize('lg')
                        ->color('gray')
                        ->iconButton()
                        ->slideOver()
                        ->form([
                            TextInput::make('subject'),
                        ])
                        ->action(function (array $data) {
                            // Handle the action logic here
                            dd($data);
                            
                        });

                    return view('components.add-cart-button', compact('action'));
                }
            )


and here is the add-cart-button.blade.php
<div class="relative">
    {{ $action }}
    <div class="absolute start-full top-1 z-[1] w-max -translate-x-1/2 -translate-y-1/2 rtl:translate-x-1/2" style="transform: translate(-50%, -50%) translate(5px, -5px);">
        <x-filament::badge size="xs" color="warning">3</x-filament::badge>
    </div>
</div>
<div class="relative">
    {{ $action }}
    <div class="absolute start-full top-1 z-[1] w-max -translate-x-1/2 -translate-y-1/2 rtl:translate-x-1/2" style="transform: translate(-50%, -50%) translate(5px, -5px);">
        <x-filament::badge size="xs" color="warning">3</x-filament::badge>
    </div>
</div>


Can someone please show me what's wrong and point me in the right direction. Thank you.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Action button on Topbar
FilamentFFilament / ❓┊help
2y ago
action button in topbar
FilamentFFilament / ❓┊help
17mo ago
Add content on topbar
FilamentFFilament / ❓┊help
3y ago
Add Button Form Action
FilamentFFilament / ❓┊help
2y ago