1. Go to this page and download the library: Download bbs-lab/nova-items-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bbs-lab / nova-items-field example snippets
protected $casts = [
'tags' => 'array',
];
use BBSLab\NovaItemsField\Items;
public function fields(NovaRequest $request): array
{
return [
Items::make('Tags')
->chips()
->suggestions(['laravel', 'nova', 'vue'])
->rules('max:10')
->itemRules('string', 'max:255'),
];
}
Items::make('Steps')
->draggable() // drag handle to reorder
->min(1)->max(10) // bounds (validated + reflected in the UI)
->maxHeight(300) // scrollable list (px)
->inputType('email') // any HTML input type
->placeholder('Add a step…')
->fullWidth();
Items::make('Tags')
->addButtonLabel('Add a tag')
->deleteButtonLabel('Remove')
->addButtonPosition('top') // 'top' or 'bottom' (default)
->hideAddButton(); // hide the add control entirely
Items::make('Emails')
->rules(' // each item must be a valid email
// Index (table cell) — defaults to a count badge with a hover tooltip:
Items::make('Tags')->indexAsChips(); // first chips + "+N" overflow
Items::make('Tags')->indexAsList(); // truncated, comma-joined text
// Detail — mirrors the form mode (list or chips); or summarize:
Items::make('Steps')->detailsAsTotal();
use Laravel\Nova\Fields\FormData;
use Laravel\Nova\Http\Requests\NovaRequest;
Items::make('Tags')
->copyable()
->dependsOn('has_tags', function (Items $field, NovaRequest $request, FormData $formData) {
$formData->boolean('has_tags') ? $field->show() : $field->hide();
});