Skip to content

vkazakevich/nova-tooltip-field

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A tooltip field for Nova apps

Latest Version on Packagist Total Downloads

With this tooltip field, you can hide some optional content.
On the index page, this field will work as a tooltip, on all other pages, it's just a text field.

Demo video

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require elbytes/nova-tooltip-field

Usage

In your resource class, add the following to your fields method:

use Elbytes\NovaTooltipField\Tooltip;

....

Tooltip::make('Type', 'type'), 

// OR

Tooltip::make('Type', 'type')
       ->setDefaultIcon('<svg width="18" height="18">...</svg>') // Optional
       ->setDependIcons([
           'fieldValue' => '<svg width="18" height="18">...</svg>',
           'fieldValue2' => '<svg width="18" height="18">...</svg>',
       ]), // Optional

Using with your own icon

To change the default icon, you need to use the setDefaultIcon method.

use Elbytes\NovaTooltipField\Tooltip;

....

Tooltip::make('Type', 'type')
    ->setDefaultIcon('<svg class="h-5 w-5">...</svg>')

Value-dependent icons

Sometimes the icon has to change depending on the value of the field, you can use the setDependIcons method for this.

use Elbytes\NovaTooltipField\Tooltip;

....

Tooltip::make('Type', 'type')
       ->setDependIcons([
           'fieldValue' => '<svg class="h-5 w-5">...</svg>',
           'fieldValue2' => '<svg class="h-5 w-5">...</svg>',
       ]),

Contribution

All contributions, big or small, are welcome!

License

The MIT License (MIT). Please see License File for more information.

About

A tooltip field to use in your Nova apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vue 56.8%
  • PHP 32.6%
  • JavaScript 10.6%