DEV Community

Cover image for Add a sidebar with options in a Filament resource
Sergio Peris
Sergio Peris

Posted on • Originally published at sertxu.dev

Add a sidebar with options in a Filament resource

Using Filament you can add a sidebar in your resource create and edit views.

Here you can see what I see when I'm writing a new post:

This layout is created using the Split component. Inside it I have two Section components, one for each column. The second Section has the grow property disabled, so it takes the minimum space required.

Also, the Split component has a xl breakpoint, if the screen is lower than that a single column layout will be shown.

The schema has by default a two column grid, so make sure your Split component has the column span set to full so it uses all the horizontal available space.

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\Split::make([
                Forms\Components\Section::make([
                    Forms\Components\TextInput::make('title')
                        ->required(),
                ]),

                Forms\Components\Section::make([
                    Forms\Components\DateTimePicker::make('published_at')
                        ->nullable(),
                ])->grow(false),
            ])->from('xl')->columnSpan('full');
        ]);
}
Enter fullscreen mode Exit fullscreen mode

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay