yojnc / nova-color-count-fields
A Laravel Nova fields with color warning count.
Installs: 51
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
Language:Vue
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-04-21 19:57:37 UTC
README
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