Code Monkey home page Code Monkey logo

nova-tag-input's Introduction

Nova Tag Input Field

This plugin incorporate the Vue Tags Input plugin by Johannes Munari into Laravel Nova by creating a new field type.

Nova Tag Input

Nova 4

This release must be used with Nova version 4 and above. Thanks to @dmason30 for the PR. To install a Nova 3 compatible version please see at the end.

Installing

Using Composer:

composer require superlatif/nova-tag-input

Example

Basic

Tags::make(__("Tags"), 'tags')
    ->help("Press ENTER to add tag")
    ->placeholder("Add a new tag")
    ->allowEditTags(true)
    ->addOnKeys([13, ':', ';', ',']) // 13 = Enter key
    ->autocompleteItems([
        'Arizona',
        'California',
        'Colorado',
        'Michigan',
        'New York',
        'Texas',
    ]),

Autocomplete items from Eloquent

$tags = Tag::pluck('title')->get();
Tags::make(__("Tags"), 'tags')
    // ...
    ->autocompleteItems($tags)
    // ...

Parameters

Parameter Description Type Default
autocompleteItems Array of strings used for autocompletion Array -
addOnKeys Set of characters triggering tag insertion Array [13]
separators Defines characters which split text into tags (useful when copy-pasting) Array [';']
placeholder Hint displayed when the field is empty or after a list of existing tags String -
addFromPaste Tags can be created from pasted text Boolean true
addOnBlur Tag is created when field loses focus Boolean true
addOnlyFromAutocomplete Only allow tag creation from the autocompleteItems array Boolean false
allowEditTags Allow inline tag edition Boolean false
autocompleteAlwaysOpen Autocomplete list remains open Boolean false
autocompleteFilterDuplicates Removes duplicates from autocomplete list Boolean true
autocompleteMinLength The minimum text that must be entered before autocomplete Boolean 1
avoidAddingDuplicates Prevent duplicated tags Boolean true
deleteOnBackspace Delete tags using backspace Boolean true
disabled Disable the field Boolean false
maxTags Max number of tags Boolean -

Installing

To use a Nova 3 compatible version please use the following command:

composer require superlatif/nova-tag-input:3.0

Support us!

If you think we saved you some time on your development, please consider showing your appreciation ๐Ÿ˜

Buy Me A Coffee

nova-tag-input's People

Contributors

crynobone avatar devwebch avatar dmason30 avatar simonrtv avatar superlatif-io avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.