# Nova Row Actions displays ordinary Laravel Nova actions as visible, accessible buttons in resource index rows. It uses Nova's standard action endpoint, authorization, confirmation forms, response handling, and table refresh flow. ## Requirements - PHP 8.1+ - Laravel 10.48+, 11.44+, 12.1+, or 13 - Laravel Nova 5.8.3+ ## Installation Install the package with Composer. Laravel package discovery registers its service provider and compiled Nova assets automatically. ```bash composer require meghdadfadaee/nova-row-actions ``` ## Usage Add the field to a Nova resource and keep each represented action registered in the resource's `actions()` method. The latter is required because Nova's standard action endpoint only executes actions registered by the resource. ```php use Illuminate\Database\Eloquent\Model; use MeghdadFadaee\NovaRowActions\RowActions; public function fields(NovaRequest $request): array { return [ RowActions::make('Actions') ->add( Approve::make(), icon: 'check', iconType: 'solid', color: 'success', activeWhen: fn (Model $model) => $model->approved, disabledWhen: fn (Model $model) => $model->approved, confirm: false, ) ->add( Reject::make(), icon: 'x-mark', color: 'danger', tooltip: 'Reject this record', visibleWhen: fn (Model $model) => ! $model->archived, order: 20, confirm: true, ), ]; } public function actions(NovaRequest $request): array { return [ Approve::make()->exceptInline(), Reject::make()->exceptInline(), ]; } ``` `exceptInline()` leaves actions available in Nova's bulk selector and detail view while removing them from the row ellipsis. ## Button options `add()` accepts the following named arguments: - `icon`: a Nova icon name, such as `check` or `x-mark`. - `iconType`: Heroicons `outline`, `solid`, `mini`, or `micro`; defaults to `outline`. - `color`: `default`, `primary`, `success`, `danger`, `warning`, or `info`. - `variant`: `outline`, `solid`, or `ghost`. - `label`: button/accessibility label; defaults to the action name. - `tooltip`: tooltip text; defaults to the resolved label. - `activeWhen`: boolean or row callback controlling the pressed/active state. - `disabledWhen`: boolean or row callback controlling disabled state. - `visibleWhen`: boolean or row callback controlling server-side visibility. - `order`: numeric order; insertion order is used by default. - `confirm`: `true` to force confirmation, `false` to skip it, or `null` to preserve the Nova action's own confirmation strategy. - `showLabel`: display text beside the icon; labels remain available to screen readers when this is false. Callbacks receive `(Model $model, NovaRequest $request, Action $action)` and may declare only the leading arguments they need. ### Icons Icons are rendered by Nova's `Icon` component from `laravel-nova-ui`, so the package supports Heroicons v2.1.5+ while always using the exact Heroicons release bundled by the installed Nova version. Use kebab-case names, including: `check`, `x-mark`, `plus`, `minus`, `pencil-square`, `trash`, `eye`, `bolt`, `arrow-path`, `arrow-down-tray`, `paper-airplane`, `play`, `pause`, `lock-closed`, `lock-open`, `star`, `heart`, `bell`, `envelope`, `user`, `users`, `cog-6-tooth`, `document`, `document-check`, `clipboard`, `magnifying-glass`, and `exclamation-triangle`. The package deliberately does not install a second Heroicons copy; importing Nova's UI component avoids version conflicts. For reference, Nova 5.8.3 in the test application declares and locks `@heroicons/vue` 2.2.0, whose icon API is compatible with the supported 2.1.5 baseline. ## Notes and limitations - Actions must be normal resource actions registered by `actions()`. Pivot-only actions and lens-specific endpoints are not supported by the field. - Relationship indexes are supported through Nova's `viaResource`, `viaResourceId`, and `viaRelationship` action parameters. - Nova action fields, validation errors, downloads, events, response modals, redirects, visits, danger messages, notifications, and progress state are delegated to Nova 5.8.3's native action composable. - The package ships compiled production assets; Node is only needed when modifying the Vue or CSS sources. ## Development ```bash npm ci npm test npm run production composer validate --strict ```