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

# User menu

> [!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/navigation/user-menu.md).

## Introduction

The user menu is featured in the top right corner of the admin layout. It's fully customizable.

Each menu item is represented by an [action](../actions), and can be customized in the same way. To register new items, you can pass the actions to the `userMenuItems()` method of the [configuration](https://filament-34a8cf01.mintlify.site/4.x/panel-configuration.md):

```php theme={"theme":"gruvbox-dark-hard"}
use App\Filament\Pages\Settings;
use Filament\Actions\Action;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenuItems([
            Action::make('settings')
                ->url(fn (): string => Settings::getUrl())
                ->icon('heroicon-o-cog-6-tooth'),
            // ...
        ]);
}
```

Loading preview

![User menu with custom menu item](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/panels/navigation/user-menu.jpg)

## Grouping user menu items

By default, all user menu items are rendered in a single list. If you want to separate them into distinct groups, you can pass an array of arrays to the `userMenuItems()` method. Each array is rendered as its own group, separated by a divider:

```php theme={"theme":"gruvbox-dark-hard"}
use App\Filament\Pages\Billing;
use App\Filament\Pages\Settings;
use Filament\Actions\Action;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenuItems([
            [
                Action::make('settings')
                    ->url(fn (): string => Settings::getUrl())
                    ->icon('heroicon-o-cog-6-tooth'),
                Action::make('billing')
                    ->url(fn (): string => Billing::getUrl())
                    ->icon('heroicon-o-banknotes'),
            ],
            [
                Action::make('documentation')
                    ->url('https://filamentphp.com/docs')
                    ->icon('heroicon-o-book-open'),
            ],
        ]);
}
```

Loading preview

![User menu items split into separate groups](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/panels/navigation/user-menu-grouping.jpg)

> [!NOTE]
>
> The `logout` item is added to the last group by default. To place it yourself, register it explicitly in any group using the `logout` array key. Since its default `sort()` puts it at the end of its group, adjust the sort if you want it elsewhere within the group:
>
> ```php theme={"theme":"gruvbox-dark-hard"}
> ->userMenuItems([
>     // ...
>     [
>         'logout' => fn (Action $action): Action => $action->sort(2),
>     ],
> ])
> ```

## Moving the user menu to the sidebar

By default, the user menu is positioned in the topbar. If the topbar is disabled, it is added to the sidebar.

You can choose to always move it to the sidebar by passing a `position` argument to the `userMenu()` method in the [configuration](https://filament-34a8cf01.mintlify.site/4.x/panel-configuration.md):

```php theme={"theme":"gruvbox-dark-hard"}
use Filament\Enums\UserMenuPosition;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenu(position: UserMenuPosition::Sidebar);
}
```

Loading preview

![User menu moved to the sidebar](https://filament-34a8cf01.mintlify.site/docs/images/4.x/light/panels/navigation/user-menu-sidebar.jpg)

## Customizing the profile link

To customize the user profile link at the start of the user menu, register a new item with the `profile` array key, and pass a function that [customizes the action](../actions) object:

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

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenuItems([
            'profile' => fn (Action $action) => $action->label('Edit profile'),
            // ...
        ]);
}
```

For more information on creating a profile page, check out the [authentication features documentation](../users#authentication-features).

## Customizing the logout link

To customize the user logout link at the end of the user menu, register a new item with the `logout` array key, and pass a function that [customizes the action](../actions) object:

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

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenuItems([
            'logout' => fn (Action $action) => $action->label('Log out'),
            // ...
        ]);
}
```

## Conditionally hiding user menu items

You can also conditionally hide a user menu item by using the `visible()` or `hidden()` methods, passing in a condition to check. Passing a function will defer condition evaluation until the menu is actually being rendered:

```php theme={"theme":"gruvbox-dark-hard"}
use App\Models\Payment;
use Filament\Actions\Action;

Action::make('payments')
    ->visible(fn (): bool => auth()->user()->can('viewAny', Payment::class))
    // or
    ->hidden(fn (): bool => ! auth()->user()->can('viewAny', Payment::class))
```

## Sending a `POST` HTTP request from a user menu item

You can send a `POST` HTTP request from a user menu item by passing a URL to the `url()` method, and also using `postToUrl()`:

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

Action::make('lockSession')
    ->url(fn (): string => route('lock-session'))
    ->postToUrl()
```

## Disabling the user menu

You may disable the user menu entirely by passing `false` to the `userMenu()` method:

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

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->userMenu(false);
}
```

[Edit this page on GitHub](https://github.com/filamentphp/filament/edit/4.x/docs/06-navigation/03-user-menu.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.