> ## 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.

# Rendering an infolist in a Blade view

> [!WARNING]
>
> You are currently viewing the documentation for Filament 4.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/components/infolist.md).

> [!WARNING]
>
> Before proceeding, make sure `filament/infolists` is installed in your project. You can check by running:
>
> ```bash theme={"theme":"gruvbox-dark-hard"}
> composer show filament/infolists
> ```
>
> If it's not installed, consult the [installation guide](https://filament-34a8cf01.mintlify.site/4.x/introduction/installation.md#installing-the-individual-components) and configure the **individual components** according to the instructions.

## Setting up the Livewire component

First, generate a new Livewire component:

```bash theme={"theme":"gruvbox-dark-hard"}
php artisan make:livewire ViewProduct
```

Then, render your Livewire component on the page:

```blade theme={"theme":"gruvbox-dark-hard"}
@livewire('view-product')
```

Alternatively, you can use a full-page Livewire component:

```php theme={"theme":"gruvbox-dark-hard"}
use App\Livewire\ViewProduct;
use Illuminate\Support\Facades\Route;

Route::get('products/{product}', ViewProduct::class);
```

You must use the `InteractsWithSchemas` trait, and implement the `HasSchemas` interface on your Livewire component class:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Concerns\RestrictsFileUploadsToSchemaComponents;
use Filament\Schemas\Contracts\HasSchemas;
use Livewire\Component;

class ViewProduct extends Component implements HasSchemas
{
    use InteractsWithSchemas;
    use RestrictsFileUploadsToSchemaComponents;

    // ...
}
```

## Adding the infolist

Next, add a method to the Livewire component which accepts an `$infolist` object, modifies it, and returns it:

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Schemas\Schema;

public function productInfolist(Schema $schema): Schema
{
    return $schema
        ->record($this->product)
        ->components([
            // ...
        ]);
}
```

> [!WARNING]
>
> `$product` is a model property on a regular Livewire component. Filament does not re-query or authorize it on later requests. Re-query and authorize the product before passing it to the infolist, including any tenant or ownership restrictions your application requires. See [Eloquent model restoration in Livewire](https://filament-34a8cf01.mintlify.site/4.x/advanced/security.md#understanding-eloquent-model-restoration-in-livewire) for more information.

Finally, render the infolist in the Livewire component's view:

```blade theme={"theme":"gruvbox-dark-hard"}
{{ $this->productInfolist }}
```

> [!NOTE]
>
> `filament/infolists` also includes the following packages:
>
> * `filament/actions`
> * `filament/schemas`
> * `filament/support`
>
> These packages allow you to use their components within Livewire components.
> For example, if your infolist uses [Actions](../actions), remember to implement the `HasActions` interface and use the `InteractsWithActions` trait on your Livewire component class.
>
> If you are using any other [Filament components](https://filament-34a8cf01.mintlify.site/4.x/components/overview.md#package-components) in your infolist, make sure to install and integrate the corresponding package as well.

## Passing data to the infolist

You can pass data to the infolist in two ways:

Either pass an Eloquent model instance to the `record()` method of the infolist, to automatically map all the model attributes and relationships to the entries in the infolist's schema:

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

public function productInfolist(Schema $schema): Schema
{
    return $schema
        ->record($this->product)
        ->components([
            TextEntry::make('name'),
            TextEntry::make('category.name'),
            // ...
        ]);
}
```

Alternatively, you can pass an array of data to the `constantState()` method of the infolist, to manually map the data to the entries in the infolist's schema:

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

public function productInfolist(Schema $schema): Schema
{
    return $schema
        ->constantState([
            'name' => 'MacBook Pro',
            'category' => [
                'name' => 'Laptops',
            ],
            // ...
        ])
        ->components([
            TextEntry::make('name'),
            TextEntry::make('category.name'),
            // ...
        ]);
}
```

[Edit this page on GitHub](https://github.com/filamentphp/filament/edit/4.x/docs/12-components/02-infolist.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.