> ## Documentation Index
> Fetch the complete documentation index at: https://filament-34a8cf01.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Section

> [!WARNING]
>
> You are currently viewing the documentation for Filament 3.x, which is a previous version of Filament.
>
> Looking for the current stable version? Visit the [5.x documentation](https://filament-34a8cf01.mintlify.site/5.x/infolists).

## Overview

You may want to separate your entries into sections, each with a heading and description. To do this, you can use a section component:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Rate limiting')
    ->description('Prevent abuse by limiting the number of requests per period')
    ->schema([
        // ...
    ])
```

Loading preview

![Section](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/simple.jpg)

You can also use a section without a header, which just wraps the components in a simple card:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make()
    ->schema([
        // ...
    ])
```

Loading preview

![Section without header](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/without-header.jpg)

## Adding actions to the section's header or footer

Sections can have actions in their [header](#adding-actions-to-the-sections-header) or [footer](#adding-actions-to-the-sections-footer).

### Adding actions to the section's header

You may add [actions](https://filament-34a8cf01.mintlify.site/3.x/infolists/actions.md) to the section's header using the `headerActions()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;

Section::make('Rate limiting')
    ->headerActions([
        Action::make('edit')
            ->action(function () {
                // ...
            }),
    ])
    ->schema([
        // ...
    ])
```

Loading preview

![Section with header actions](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/header/actions.jpg)

> [Make sure the section has a heading or ID](#adding-actions-to-a-section-without-heading)

### Adding actions to the section's footer

In addition to [header actions](#adding-an-icon-to-the-sections-header), you may add [actions](https://filament-34a8cf01.mintlify.site/3.x/infolists/actions.md) to the section's footer using the `footerActions()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;

Section::make('Rate limiting')
    ->footerActions([
        Action::make('edit')
            ->action(function () {
                // ...
            }),
    ])
    ->schema([
        // ...
    ])
```

Loading preview

![Section with footer actions](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/footer/actions.jpg)

> [Make sure the section has a heading or ID](#adding-actions-to-a-section-without-heading)

#### Aligning section footer actions

Footer actions are aligned to the inline start by default. You may customize the alignment using the `footerActionsAlignment()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Support\Enums\Alignment;

Section::make('Rate limiting')
    ->footerActions([
        Action::make('edit')
            ->action(function () {
                // ...
            }),
    ])
    ->footerActionsAlignment(Alignment::End)
    ->schema([
        // ...
    ])
```

### Adding actions to a section without heading

If your section does not have a heading, Filament has no way of locating the action inside it. In this case, you must pass a unique `id()` to the section:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make()
    ->id('rateLimitingSection')
    ->headerActions([
        // ...
    ])
    ->schema([
        // ...
    ])
```

## Adding an icon to the section's header

You may add an icon to the section's header using the `icon()` method:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Cart')
    ->description('The items you have selected for purchase')
    ->icon('heroicon-m-shopping-bag')
    ->schema([
        // ...
    ])
```

Loading preview

![Section with icon](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/icons.jpg)

## Positioning the heading and description aside

You may use the `aside()` method to align the heading and description on the left, and the infolist components inside a card on the right:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Rate limiting')
    ->description('Prevent abuse by limiting the number of requests per period')
    ->aside()
    ->schema([
        // ...
    ])
```

Loading preview

![Section with heading and description aside](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/aside.jpg)

## Collapsing sections

Sections may be `collapsible()` to optionally hide content in long infolists:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Cart')
    ->description('The items you have selected for purchase')
    ->schema([
        // ...
    ])
    ->collapsible()
```

Your sections may be `collapsed()` by default:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Cart')
    ->description('The items you have selected for purchase')
    ->schema([
        // ...
    ])
    ->collapsed()
```

Loading preview

![Collapsed section](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/collapsed.jpg)

### Persisting collapsed sections

You can persist whether a section is collapsed in local storage using the `persistCollapsed()` method, so it will remain collapsed when the user refreshes the page:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Cart')
    ->description('The items you have selected for purchase')
    ->schema([
        // ...
    ])
    ->collapsible()
    ->persistCollapsed()
```

To persist the collapse state, the local storage needs a unique ID to store the state. This ID is generated based on the heading of the section. If your section does not have a heading, or if you have multiple sections with the same heading that you do not want to collapse together, you can manually specify the `id()` of that section to prevent an ID conflict:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Cart')
    ->description('The items you have selected for purchase')
    ->schema([
        // ...
    ])
    ->collapsible()
    ->persistCollapsed()
    ->id('order-cart')
```

## Compact section styling

When nesting sections, you can use a more compact styling:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Rate limiting')
    ->description('Prevent abuse by limiting the number of requests per period')
    ->schema([
        // ...
    ])
    ->compact()
```

Loading preview

![Compact section](https://filament-34a8cf01.mintlify.site/docs/images/3.x/light/infolists/layout/section/compact.jpg)

## Using grid columns within a section

You may use the `columns()` method to easily create a [grid](https://filament-34a8cf01.mintlify.site/3.x/infolists/layout/grid.md) within the section:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Infolists\Components\Section;

Section::make('Heading')
    ->schema([
        // ...
    ])
    ->columns(2)
```

[Edit this page on GitHub](https://github.com/filamentphp/filament/edit/3.x/packages/infolists/docs/04-layout/05-section.md)

## Sponsored by

[Your logo here](https://github.com/sponsors/danharrin)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.