PHPackages                             dnwjn/nova-button - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dnwjn/nova-button

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dnwjn/nova-button
=================

A Laravel Nova package for adding buttons to your resources.

5.0.0(1y ago)1198.5k↓36%5[7 PRs](https://github.com/dnwjn/nova-button/pulls)MITPHPPHP ^8.1CI passing

Since Jan 6Pushed 3mo agoCompare

[ Source](https://github.com/dnwjn/nova-button)[ Packagist](https://packagist.org/packages/dnwjn/nova-button)[ Docs](https://github.com/dnwjn/nova-button)[ RSS](/packages/dnwjn-nova-button/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (3)Versions (48)Used By (0)

Nova Button
===========

[](#nova-button)

[![Latest Version on Github](https://camo.githubusercontent.com/9ac53b5667c39a4536ece574d2ce1662c7081b48b353e68fd7030eb7ebb0be20/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f646e776a6e2f6e6f76612d627574746f6e2e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/dnwjn/nova-button/releases)[![Total Downloads](https://camo.githubusercontent.com/21a6d20ff5cd1ab08f23c6f6b197e851233b5df5845bb32e72e6aac052358039/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646e776a6e2f6e6f76612d627574746f6e2e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/dnwjn/nova-button)[![Github issues](https://camo.githubusercontent.com/fe45d6c499dad6093de356eaf12dd52d12add72fd2ceb3d0185cba49b21bc344/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646e776a6e2f6e6f76612d627574746f6e3f7374796c653d666f722d7468652d6261646765)](https://github.com/dnwjn/nova-button/issues)[![License](https://camo.githubusercontent.com/81e16fd27e60829c697279761aa1e04b26a0d6b6b7ddcea2594a1411a7ac80b4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646e776a6e2f6e6f76612d627574746f6e3f7374796c653d666f722d7468652d6261646765)](https://github.com/dnwjn/nova-button/blob/main/LICENSE)

A Nova package for rendering buttons on different views.

Use buttons to trigger backend events, navigate Nova routes or visit links.

[![example-users](https://user-images.githubusercontent.com/57711725/152637226-e7047831-b726-4940-95c9-617db4d42de4.png)](https://user-images.githubusercontent.com/57711725/152637226-e7047831-b726-4940-95c9-617db4d42de4.png)

> **This package is a continuation of [dillingham/nova-button](https://github.com/dillingham/nova-button).**
>
> I created this fork because the original package seemed abandoned (last release on 16-09-2020 at the time of writing) and for me it was too useful to leave unmaintained. I also noticed that there still was activity in the issues and pull requests, which I didn't want to be left ignored.
>
> *This package remains open source, so I encourage everyone to keep contributing! And if you want to get in touch with me,**feel free to do so!*

Versions
--------

[](#versions)

For almost every Nova version, certain changes have to be made that renders the package not backwards compatible with the previous version. Please see the table below to determine which version you need.

VersionNovav5 (current)5.0[v4](https://github.com/dnwjn/nova-button/tree/v4)4.0[v3](https://github.com/dnwjn/nova-button/tree/v3)3.0**Please note:** the `main` branch will always be the latest major version.

Requirements
------------

[](#requirements)

WhatVersionPHP&gt;=8.1Laravel&gt;=10.34Nova&gt;=5.0Installation
------------

[](#installation)

You can install this package by running the following command:

```
composer require dnwjn/nova-button:^5.0
```

To publish the config file, run the following command:

```
php artisan vendor:publish --tag="nova-button-config"
```

Usage
-----

[](#usage)

```
use Dnwjn\NovaButton\Button;
```

```
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        Text::make('Name', 'name'),
        Button::make('Notify'),
    ];
}
```

### Quick links

[](#quick-links)

- [Nova Button](#nova-button)
    - [Versions](#versions)
    - [Requirements](#requirements)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Quick links](#quick-links)
        - [Confirm](#confirm)
        - [Reload](#reload)
        - [Laravel Events](#laravel-events)
        - [JavaScript Events](#javascript-events)
        - [Texts](#texts)
            - [Title](#title)
            - [Label](#label)
            - [Index name](#index-name)
        - [State](#state)
            - [Visibility](#visibility)
            - [Disabled](#disabled)
        - [Feedback](#feedback)
        - [Nova routes](#nova-routes)
        - [Links](#links)
        - [Classes](#classes)
        - [Styles](#styles)
    - [Changelog](#changelog)
    - [Contributing](#contributing)
    - [Credits](#credits)
    - [License](#license)

---

### Confirm

[](#confirm)

You can require a confirmation for destructive actions:

```
Button::make('Cancel Account')->confirm('Are you sure?'),
Button::make('Cancel Account')->confirm('Confirmation', 'Are you sure you want to cancel your account?'),
Button::make('Cancel Account')->confirm('Confirmation', 'Are you sure you want to cancel your account?', 'Cancel'),
```

### Reload

[](#reload)

You can reload the page after all events have finished.

```
Button::make('Notify')->reload()
```

If you click multiple buttons, reloading will wait for all buttons to finish.

If an error occurs, the page will not be reloaded.

### Laravel Events

[](#laravel-events)

By default, clicking the button will trigger an event via AJAX.

Default event: `Dnwjn\NovaButton\Events\ButtonClick`.

The event will receive the key it was triggered from and, if available, the resource model:

- `$event->key` = `'notify'`
- `$event->resource` = `\Illuminate\Database\Eloquent\Model|null`

You can override the key:

```
Button::make('Notify', 'notify-some-user')
```

And also the event:

```
Button::make('Notify')->event(App\Events\NotifyRequested::class)
```

You can listen to the event by creating a listener and registering it in your `EventServiceProvider`.

### JavaScript Events

[](#javascript-events)

By default, clicking the button will cause an event to be dispatched via `Nova.$emit`.

Default event: `Dnwjn\NovaButton\Events\ButtonClick`.

The event can then be picked up via `Nova.$on`, and will receive the triggering key and any optional arguments.

You can specify the key and optional arguments:

```
Button::make('Notify', 'notify-some-user')
    ->emit('notification', ['article_id' => 1, 'which' => 'tags'])
```

You can listen to the event by creating a listener in your Vue component or JavaScript:

```
Nova.$on('notification', (e) => {
    // e.article_id = 1
    // e.which = 'tags'
})
```

### Texts

[](#texts)

#### Title

[](#title)

You can set the title attribute for the button:

```
Button::make('Notify')->title('Button title')
```

#### Label

[](#label)

You can set the label for the button, which is shown on the detail, create and update views:

```
Button::make('Notify')->label('Button label')
```

#### Index name

[](#index-name)

You can set the index name for the button, which is shown on the index view as the table header:

```
Button::make('Notify')->indexName('Actions')
```

Default is set to the button name. You can also pass `null` to have no index name.

### State

[](#state)

#### Visibility

[](#visibility)

You can conditionally show the button:

```
Button::make('Activate')->visible($this->is_active === false),
Button::make('Deactivate')->visible($this->is_active === true),
```

Or, if you only want specific users to see the button:

```
Button::make('Notify')->visible($request->user()->can('notifyUser', $this))
```

Of course you can also use Nova's builtin methods, like for [authorization](https://nova.laravel.com/docs/3.0/resources/authorization.html#fields)or to limit visibility to [specific views](https://nova.laravel.com/docs/3.0/resources/fields.html#showing-hiding-fields).

If you want to show a button on the create or update views you can simply use Nova's builtin methods:

```
Button::make('Notify')->showOnCreating()->showOnUpdating()
```

#### Disabled

[](#disabled)

You can disable the button:

```
Button::make('Notify')->disabled()
Button::make('Notify')->disabled($this->is_complete === false)
```

### Feedback

[](#feedback)

When using events, you might want to provide visual feedback to the end user. This is especially useful for long running listeners.

```
Button::make('Notify')
    ->loadingText('Sending...')
    ->successText('Sent!')
    ->errorText('Something went wrong...')
```

There are 3 events and for each event you can provide the text and style:

EventTextStyle`loading``->loadingText('Sending...')``->loadingStyle('gray-outline')``success``->successText('Done!')``->successStyle('success')``error``->errorText('Something went wrong...')``->errorStyle('danger')`The defaults are defined in the [config file](https://github.com/dnwjn/nova-button/blob/main/config/nova-button.php).

### Nova routes

[](#nova-routes)

You can also choose to navigate to any Nova route:

```
Button::make('Text')->route('vuejs-route-name', ['id' => 1])
Button::make('Text')->index(App\Nova\User::class)
Button::make('Text')->detail(App\Nova\User::class, $this->user_id)
Button::make('Text')->create(App\Nova\User::class)
Button::make('Text')->edit(App\Nova\User::class, $this->user_id)
```

You can also set query parameters:

```
Button::make('Text')
    ->route('home')
    ->withParams(['referrer' => 'nova'])
```

It's also possible to use a resource's filters:

```
Button::make('Text')
    ->index(App\Nova\Order::class)
    ->withFilters([
        App\Nova\Filters\UserOrders::class => $this->user_id,
        App\Nova\Filters\OrderStatus::class => 'active',
    ])
```

### Links

[](#links)

You can configure the button to open external links:

```
Button::make('Text')->link('https://nova.laravel.com')
Button::make('Text')->link('https://nova.laravel.com', '_self')
```

### Classes

[](#classes)

The button uses the following classes that you can style to your liking:

```
.nova-button
.nova-button-{resource-name}
.nova-button-success
.nova-button-error
.nova-button-loading
```

You can also add more classes to a button:

```
// One class
Button::make('Notify')->classes('some-class')

// Or multiple classes
Button::make('Notify')->classes('some-class', 'another-class')
```

### Styles

[](#styles)

This package uses [tailwind-css](https://tailwindcss.com) classes. The default class used is the `link` class.

You can define the class the button should use:

```
Button::make('Delete')->style('danger')
```

The default available classes are as follows:

FillOutlineLinkprimaryprimary-outlineprimary-linksuccesssuccess-outlinesuccess-linkwarningwarning-outlinewarning-linkdangerdanger-outlinedanger-linkinfoinfo-outlineinfo-linkgraygray-outlinegray-linkThe passed key refers to one of the classes defined in the [config file](https://github.com/dnwjn/nova-button/blob/main/config/nova-button.php). You are free to change these classes or add your own.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [dnwjn](https://github.com/dnwjn)

Author of original package: [dillingham](https://github.com/dillingham)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance61

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 62.1% 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 ~57 days

Recently: every ~69 days

Total

39

Last Release

534d ago

Major Versions

2.1.1 → 3.0.02022-06-14

3.1.1 → 4.0.02022-12-29

3.2.2 → 4.0.12023-02-23

v3.x-dev → 4.3.12024-03-20

v4.x-dev → 5.0.0-rc12024-12-22

PHP version history (3 changes)2.0.0PHP &gt;=7.3.0

2.1.1PHP ^7.3|^8.0

5.0.0-rc1PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57711725?v=4)[Danique Wijnalda](/maintainers/dnwjn)[@dnwjn](https://github.com/dnwjn)

---

Top Contributors

[![dnwjn](https://avatars.githubusercontent.com/u/57711725?v=4)](https://github.com/dnwjn "dnwjn (113 commits)")[![dillingham](https://avatars.githubusercontent.com/u/29180903?v=4)](https://github.com/dillingham "dillingham (27 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![adamturcsan](https://avatars.githubusercontent.com/u/6500048?v=4)](https://github.com/adamturcsan "adamturcsan (8 commits)")[![bernhardh](https://avatars.githubusercontent.com/u/642292?v=4)](https://github.com/bernhardh "bernhardh (2 commits)")[![ahmedkandel](https://avatars.githubusercontent.com/u/28398523?v=4)](https://github.com/ahmedkandel "ahmedkandel (2 commits)")[![sfinktah](https://avatars.githubusercontent.com/u/4650770?v=4)](https://github.com/sfinktah "sfinktah (2 commits)")[![dkulyk](https://avatars.githubusercontent.com/u/370042?v=4)](https://github.com/dkulyk "dkulyk (1 commits)")[![algethamy](https://avatars.githubusercontent.com/u/9952761?v=4)](https://github.com/algethamy "algethamy (1 commits)")[![4n70w4](https://avatars.githubusercontent.com/u/38257723?v=4)](https://github.com/4n70w4 "4n70w4 (1 commits)")[![KasparRosin](https://avatars.githubusercontent.com/u/33309407?v=4)](https://github.com/KasparRosin "KasparRosin (1 commits)")[![LorenzoSapora](https://avatars.githubusercontent.com/u/25519274?v=4)](https://github.com/LorenzoSapora "LorenzoSapora (1 commits)")[![lucidlogic](https://avatars.githubusercontent.com/u/932221?v=4)](https://github.com/lucidlogic "lucidlogic (1 commits)")[![maherelgamil](https://avatars.githubusercontent.com/u/6294478?v=4)](https://github.com/maherelgamil "maherelgamil (1 commits)")

---

Tags

laravelnovalaravelnova

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/dnwjn-nova-button/health.svg)

```
[![Health](https://phpackages.com/badges/dnwjn-nova-button/health.svg)](https://phpackages.com/packages/dnwjn-nova-button)
```

###  Alternatives

[ebess/advanced-nova-media-library

Laravel Nova tools for managing the Spatie media library.

6163.5M22](/packages/ebess-advanced-nova-media-library)[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2862.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2862.0M9](/packages/outl1ne-nova-sortable)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57239.7k](/packages/sbine-route-viewer)[mostafaznv/nova-map-field

Map Field for Laravel Nova

46101.8k](/packages/mostafaznv-nova-map-field)

PHPackages © 2026

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