Downloads
Stars
Version
A colorable notifications in text or textarea Nova fields about min chars reached.
Install the package into a Laravel app that uses Nova with Composer:
composer require yojnc/nova-color-count-fields
You must call minChars() method on field to show counter
minChars($count)
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.
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.
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