© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
16 replies
nathan269_

Conditional Pageblock Dependent On Resource

Is there a way to only display a pageblock in a particular resource? I have this for example:

public static function getBlockSchema(): Block
    {
        return Block::make('exit_popup')
            ->label('Exit Popup')
            ->when('resource', 'ComponentResource')
            ->schema([
                TextInput::make('title')
                    ->label('Title')
                    ->required(),

                TextArea::make('intro')
                    ->label('Intro')
                    ->required(),

                TextInput::make('submission_message')
                    ->label('Submission Message')
                    ->required(),

                TextInput::make('button_label')
                    ->label('Button Label')
                    ->required(),
            ]);
    }
public static function getBlockSchema(): Block
    {
        return Block::make('exit_popup')
            ->label('Exit Popup')
            ->when('resource', 'ComponentResource')
            ->schema([
                TextInput::make('title')
                    ->label('Title')
                    ->required(),

                TextArea::make('intro')
                    ->label('Intro')
                    ->required(),

                TextInput::make('submission_message')
                    ->label('Submission Message')
                    ->required(),

                TextInput::make('button_label')
                    ->label('Button Label')
                    ->required(),
            ]);
    }


I only want this pageblock to be visible within the ComponentResource. Is this possible?
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

Conditional resource on panel
FilamentFFilament / ❓┊help
2y ago
Conditional action on view resource page
FilamentFFilament / ❓┊help
3y ago
Conditional Resource/Navigation Label
FilamentFFilament / ❓┊help
3y ago
Conditional Redirect for Resource Pages
FilamentFFilament / ❓┊help
3y ago