Skip to main content
The sidebar package can be configured through the config/sidebar.php file. Publish it if you haven’t already:

Configuration Options

Caching

Caching Methods:
  • null - No caching, sidebar is rebuilt on every request
  • static - Cache the sidebar once for all users
  • user-based - Cache per user (useful when authorization differs per user)
For production environments with static sidebars, use static caching to improve performance.

Dimensions

These values are available as CSS variables --sidebar-width and --sidebar-collapsed-width.

Responsive Breakpoint

The pixel width below which the sidebar switches to mobile mode. In mobile mode:
  • The sidebar is hidden by default
  • Opening the sidebar shows it as an overlay
  • The sidebar cannot be collapsed (only opened/closed)

Collapsible

Whether the sidebar can be collapsed on desktop screens. When set to false, the collapse functionality is disabled and the sidebar remains at full width.

Full Configuration Example

Environment Variables

You can use environment variables for deployment flexibility:

Accessing Configuration

Use the helper functions to access configuration values:

Injecting CSS Variables

Use the helper functions to inject CSS variables in your layout:
The data-* attributes are automatically read by the Alpine.js sidebar store to configure its behavior.

Customizing Views

Publish the views to customize the sidebar rendering:
This publishes the following views to resources/views/vendor/sidebar/:

Example: Customizing the Item View

Clearing the Cache

To clear the sidebar cache, use Laravel’s cache commands:
The package also provides a SidebarFlusher service that you can use programmatically: