PHPackages                             bernhardh/nova-dynamic-views - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. bernhardh/nova-dynamic-views

AbandonedArchivedLibrary[Admin Panels](/categories/admin)

bernhardh/nova-dynamic-views
============================

A tool for easier overwriting custom-header and toolbaars in Laravel Nova

1.5.1(3y ago)17101.2k9[1 issues](https://github.com/bernhardh/nova-dynamic-views/issues)MITPHPPHP &gt;=7.1.0

Since Oct 14Pushed 3y ago2 watchersCompare

[ Source](https://github.com/bernhardh/nova-dynamic-views)[ Packagist](https://packagist.org/packages/bernhardh/nova-dynamic-views)[ RSS](/packages/bernhardh-nova-dynamic-views/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)DependenciesVersions (10)Used By (0)

Warning!!!!
===========

[](#warning)

This repository is archived and no longer supported. It doesn't work with Nova 4. Just have a look at the form from

---

Nova dynamic views
==================

[](#nova-dynamic-views)

This package is meant to be used **INSTEAD** of overwriting the `custom-index-header`, `custom-index-toolbar`, `custom-detail-header`, `custom-detail-toolbar`, etc. by yourself. It provides a much easier API for it and it allows you to use these "placeholder" components multiple times without overwriting each other.

[![2020-10-14_16-13](https://user-images.githubusercontent.com/642292/96001510-6592a980-0e38-11eb-9aea-54ebbf6126d1.png)](https://user-images.githubusercontent.com/642292/96001510-6592a980-0e38-11eb-9aea-54ebbf6126d1.png)

Installation
------------

[](#installation)

Require the package with composer

```
composer require bernhardh/nova-dynamic-views

```

Register the tool in the `tools` method in your `\App\Providers\NovaServiceProvider`:

```
use Bernhardh\NovaDynamicViews\NovaDynamicViews;

...

public function tools() {
    return [
        new NovaDynamicViews()
    ];
}
```

Usage
-----

[](#usage)

Let's say you want to add a custom button to the `toolbar` of all `index` views. Just create a vue component for it, as you would do if you use the `custom-index-header` (see section "Create custom component" if you don't know how to). Let's call it `my-index-toolbar-btn`. Now the only thing you have to do is register it to your `\App\Ņova\Resource` class, within a new method called `customIndexToolbarComponents`, which returns a `\Bernhardh\NovaDynamicViews\CustomComponents` object:

```
public function customIndexToolbarComponents()
{
    return CustomComponents::make()
       ->addItem('my-index-toolbar-btn');
}
```

Thats it. Now you should see the content of your component in the toolbar.

### Provide extra data

[](#provide-extra-data)

If you want to add extra data (for example a label) to your component (without extra request), just add it to the `addItem` method as second parameter (as array):

```
public function customIndexToolbarComponents()
{
    return CustomComponents::make()
       ->addItem('my-index-toolbar-btn', [
           'label' => 'My label'
       ]);
}
```

### Access resource data

[](#access-resource-data)

You have access to the ressource class in all methods by using `$this`. On `detail` and `edit` components, you have access to the ID of the current model with `request('id')`. So if you need the model itself in your `customDetailhHeaderComponents`, `customDetailToolbarComponents` or your `customUpdateHeaderComponents`, you can query for it like so:

```
public function customDetailToolbarComponents()
{
    $model = $this->model()->query()->where('id', request('id'))->first();

    //...
}
```

### Add (tailwind) class to the container

[](#add-tailwind-class-to-the-container)

If you want to add additional CSS classes to the container div of a section (for example add `flex w-full justify-end items-center mx-3` to the `customIndexToolbarComponents` section), add the `class` in the `make` function (or use the `setClass` method):

```
public function customIndexToolbarComponents()
{
    return CustomComponents::make('flex w-full justify-end items-center mx-3')
       ->addItem('my-index-toolbar-btn');
}
```

### Full usage example

[](#full-usage-example)

```
class Resource extends \Laravel\Nova\Resource {
    ...

    /**
     * Using the `custom-index-toolbar` placeholder component
     *
     * @return array[]
     */
    public function customIndexToolbarComponents()
    {
        return CustomComponents::make('flex w-full justify-end items-center mx-3')
            ->addItem('my-index-toolbar-btn', [
                'title' => 'My first btn'
            ])
            ->addItem('my-index-toolbar-btn', [
                'title' => 'My second btn'
            ]);
    }

    /**
     * Using the `custom-detail-header` placeholder component
     *
     * @return array[]
     */
    public function customDetailHeaderComponents()
    {
        $model = $this->model()->query()->where('id', request('id'))->first();

        return CustomComponents::make()
           ->addItem('my-other-component', [
                'id' => $model->id,
                'name' => $model->name
           ]);
    }
}
```

### Use only on specific resources

[](#use-only-on-specific-resources)

If you want to show this button only on a specific resource, for example only for Users, just add this method to the `\App\Nova\User` class.

Available methods and areas
---------------------------

[](#available-methods-and-areas)

All `custom-*-*` nova placeholders (except `custom-dashboard-header`) are available as camel case methods postfixed with `Components`:

- `customAttachHeaderComponents`
- `customCreateHeaderComponents`
- `customDetailhHeaderComponents`
- `customDetailToolbarComponents`
- `customIndexHeaderComponents`
- `customIndexToolbarComponents`
- `customLensHeaderComponents`
- `customUpdateAttachHeaderComponents`
- `customUpdateHeaderComponents`

Create custom component
-----------------------

[](#create-custom-component)

This is just a kick start documentation for this. For more info, see

Create a new resource tool with artisan:

```
php artisan nova:resource-tool acme/my-index-toolbar-btn
```

and say yes to all questions of the prompt. Now you can use this component (located ad `nova-components/my-index-toolbar-btn`) inside your `customXXXComponents` (f.e. `customIndexToolbarComponents`)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~81 days

Recently: every ~120 days

Total

9

Last Release

1387d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ed343a2b516345609708c656b59c79eebf1c86db4bbcf7044723e3091475520?d=identicon)[bernhardh](/maintainers/bernhardh)

---

Top Contributors

[![bernhardh](https://avatars.githubusercontent.com/u/642292?v=4)](https://github.com/bernhardh "bernhardh (26 commits)")[![gachowy](https://avatars.githubusercontent.com/u/332179?v=4)](https://github.com/gachowy "gachowy (1 commits)")[![alexrififi](https://avatars.githubusercontent.com/u/21067613?v=4)](https://github.com/alexrififi "alexrififi (1 commits)")[![LorenzoSapora](https://avatars.githubusercontent.com/u/25519274?v=4)](https://github.com/LorenzoSapora "LorenzoSapora (1 commits)")[![peter-aanzee](https://avatars.githubusercontent.com/u/78078916?v=4)](https://github.com/peter-aanzee "peter-aanzee (1 commits)")[![sharafat](https://avatars.githubusercontent.com/u/810435?v=4)](https://github.com/sharafat "sharafat (1 commits)")[![JuliusB](https://avatars.githubusercontent.com/u/9655075?v=4)](https://github.com/JuliusB "JuliusB (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/bernhardh-nova-dynamic-views/health.svg)

```
[![Health](https://phpackages.com/badges/bernhardh-nova-dynamic-views/health.svg)](https://phpackages.com/packages/bernhardh-nova-dynamic-views)
```

###  Alternatives

[benjacho/belongs-to-many-field

belongsToMany nova representation in field.

158811.4k1](/packages/benjacho-belongs-to-many-field)[pdmfc/nova-action-button

A Laravel Nova field to run actions.

37733.0k1](/packages/pdmfc-nova-action-button)[khalin/nova-link-field

A Laravel Nova Link field.

31562.2k2](/packages/khalin-nova-link-field)[ebess/nova-collapsible-sidebar

A collapsible sidebar for Laravel Nova.

32313.2k](/packages/ebess-nova-collapsible-sidebar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
