yojnc/nova-color-count-fields

A Laravel Nova fields with color warning count.

Downloads

51

Stars

4

Version

Laravel Nova Color Counter Field

A colorable notifications in text or textarea Nova fields about min chars reached.

Installation

Install the package into a Laravel app that uses Nova with Composer:

composer require yojnc/nova-color-count-fields

Usage

You must call minChars() method on field to show counter

minChars($count)

Text Field

Add the field to your resource in the fields method:

use YojNC\Fields\ColorCountText;

ColorCountTextArea::make('Title')->minChars($minChars), // integer

The field is displayed as an <input type="text"> element.

The field extends the Laravel\Nova\Fields\Text field, so all the usual methods are available.

Textarea Field

use YojNC\Fields\ColorCountTextArea;

ColorCountTextArea::make('Title')->minChars($minChars), // integer

The field is displayed as an <textarea></textare> element.

The field extends the Laravel\Nova\Fields\TextArea field, so all the usual methods are available.

Available methods

To show warning (yellow) between danger and success use this

use YojNC\Fields\ColorCountTextArea;

ColorCountTextArea::make('Title')->minChars($count)->errorUntil($percentageInt), //default $pectentage = 80

To show counter inside alert box use this

use YojNC\Fields\ColorCountTextArea;

ColorCountTextArea::make('Title')->minChars($count)->withCounter($showBool), //default $showBool = false