blendbyte/nova-items-field

Array items field for Laravel Nova with drag/drop sorting, validation & flexible display options. Fork of dillingham/nova-items-field, maintained for Nova 5.

Maintainers

Package info

github.com/blendbyte/nova-items-field

Language:Vue

pkg:composer/blendbyte/nova-items-field

Statistics

Installs: 526 736

Dependents: 0

Suggesters: 0

Stars: 14

Open Issues: 1

2.0.1 2025-05-12 09:36 UTC

This package is auto-updated.

Last update: 2026-04-18 04:17:23 UTC


README

Latest Version on Packagist Software License

Laravel Nova array items field with sorting, validation & many display options.

Forked from dillingham/nova-items-field.

nova-array-input-field

Installation

composer require blendbyte/nova-items-field

Quick Start

use NovaItemsField\Items;

function fields() {
    return [
        Items::make('Emails'),
    ];
}

Be sure to cast the property as an array on your Eloquent model:

public $casts = [
    'emails' => 'array',
];

Validation

Use Laravel's built-in array validation:

Items::make('Emails')->rules([
    null => 'required|min:2',
    '*'  => 'email|min:10',
]),

In this case, an error is produced if there aren't at least 2 items in the array and if each item is not a valid email or is shorter than 10 characters.

You can also use explicit attribute names — the behaviour is exactly the same:

Items::make('Emails', 'user_email')->rules([
    'user_email'   => 'required|min:2',
    'user_email.*' => 'email|min:10',
]),

Array Processing

Use the array to perform other actions by making an observer:

function saving($user)
{
    foreach ($user->emails as $email) {
        //
    }
}

Customizing the Vue Component

You can replace the default item Vue component — see this walkthrough for a brief guide.

Options

Method Description Default
->max(number) Limit number of items allowed false
->draggable() Turn on drag/drop sorting false
->fullWidth() Increase the width of the field area false
->maxHeight(pixel) Limit the height of the list false
->listFirst() Move "add new" to the bottom false
->inputType(text) Input type: text, date, etc. "text"
->placeholder($value) Placeholder text for the new item input "Add a new item"
->deleteButtonValue($value) Label for the delete button "x"
->createButtonValue($value) Label for the create button "Add"
->hideCreateButton() Hide the "Add" button false
->indexAsList() Display items as a list on index instead of a count false
->detailsAsTotal() Display item count on detail view instead of a list false

Maintained by Blendbyte


Blendbyte

Blendbyte builds cloud infrastructure, web apps, and developer tools.
We've been shipping software to production for 20+ years.

This package runs in our own stack, which is why we keep it maintained.
Issues and PRs get read. Good ones get merged.


blendbyte.com · hello@blendbyte.com