Ranting field for the Filament forms

Overview

Ranting field for the Filament forms

Rating

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require yepsua/filament-rating-field

Optionally, you can publish the views using

php artisan vendor:publish --tag="filament-rating-field-views"

Usage

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
            ...
        ];
    }
...
Rating

By default the range values goes from 1 to 5 and the icon displayed is heroicon-o-star

The rating fields provides several option to customize its behavior. Next some of the more used for:

Disabled

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->disabled()
            ...
        ];
    }
...
Rating

Min and max values

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->min(5)
                ->max(10)
            ...
        ];
    }
...
Rating

Custom icons and colors

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->icons('heroicon-o-moon', 'heroicon-s-sun')
                ->color('orange')
            ...
        ];
    }
...
Rating

Custom size

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->size(10)
            ...
        ];
    }
...
Rating

No mouse effects

Disable the mouseenter and mouseleave animation.

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->effects(false)
            ...
        ];
    }
...

Clearable

Allow the user to clear the rating selection.

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->clearable()
                ->clearIconColor('red')
                ->clearIconTooltip('Clear')
            ...
        ];
    }
...
Rating

Cursors

The value of the cursor is based on the Tailwind cursor. The prefix cursor- its not required in the value.

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->cursor('default')
                ->clearIconTooltip('none')
            ...
        ];
    }
...

Tooltips

use Yepsua\Filament\Forms\Components\Rating

...
    protected function getFormSchema(): array
    {
        return [
            ...
            Rating::make('rating')
                ->options([
                    'Acceptable',
                    'Good',
                    'Very Good',
                    'Excellent',
                ])
            ...
        ];
    }
...
Rating

Field options.

  • ->color(): Set the icon colors for the rating field.
  • ->disabledColor(): Set the icon color when the field is disabled.
  • ->clearIconColor(): Set the color for the clear icon.
  • ->icon(): Set the icon for the default items.
  • ->selectedIcon(): Set the solid icon for the selected items.
  • ->clearIcon(): Set the icon for the clear action.
  • ->min(): Set the min value for the rating field. Default: 1
  • ->max(): Set the max value for the rating field. Default: 5
  • ->width(): Set the width value for each item in the field: Default: 6
  • ->height(): Set the height value for each item in the field: Default: 6
  • ->size(): Set the same value for the width and height properties.
  • ->effects(): Enable\Disable the mouseenter and mouseleave effects. Default: true (enabled)
  • ->clearable(): Add a extra icon at the end of the rating icons. Default: false
  • ->cursor(): Set the default cursor
  • ->disabledCursor(): Set the cursor to be displayed when the field is disabled
  • ->clearIconTooltip(): Set the tooltip for the clear icon.

You can review the default value for the options above and others in the class App\Forms\Components\Rating

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

You might also like...
PHP library to create and validate html forms

FormManager Note: this is the documentation of FormManager 6.x For v5.x version Click here Installation: This package requires PHP=7.1 and is availab

Create easy (and almost magic) forms
Create easy (and almost magic) forms

Why Magic Forms? Almost everyday we do forms for our clients, personal projects, etc Sometimes we need to add or remove fields, change validations, st

Fresns core library: Cross-platform general-purpose multiple content forms social network service software
Fresns core library: Cross-platform general-purpose multiple content forms social network service software

About Fresns Fresns is a free and open source social network service software, a general-purpose community product designed for cross-platform, and su

A library of powerful code snippets to help you get the job done with Gravity Forms and Gravity Perks.

Gravity Wiz Snippet Library Gravity Wiz is creating the most comprehensive library of snippets for Gravity Forms ever. We'll be consistently moving ou

đź”’ Built a recaptcha for Nifty that works with Wordpress's Gravity Forms
đź”’ Built a recaptcha for Nifty that works with Wordpress's Gravity Forms

Recaptcha Fully Functioning spam filter that has 10 levels of security, but is slim and rpackaged to integrate with any Gravity Forms form WORKING EXA

A challenge to develop frontend-backend forms and account creating.
A challenge to develop frontend-backend forms and account creating.

Symfony + Vue (Back/Front) Helped and assisted by Vanessa and Paulo. This project have two sides, the back-end(Symfony) and the front-end(Vue.js) for

Javascript-powered auto-completion functionality for your Symfony forms!

Symfony UX Autocomplete Javascript-powered auto-completion functionality for your Symfony forms! EXPERIMENTAL This component is currently experimental

My personal uptime checker powered by Filament. ⚡️

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Manage your Sanctum tokens inside of Filament. ✨

:package_description This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Installation You can i

Comments
Owner
Soluciones TecnolĂłgicas Yepsua C.A.
null
A measurement field for ProcessWire

Fieldtype Measurement This fieldtype allows a measurement unit to be stored with a corresponding measurement value ('magnitude'). The relevant details

Mark Evens 2 Aug 6, 2022
A layout field that forces translations to have the same structure.

Kirby translatedlayout plugin A layout field that forces translations to have anidentical structure to the one of the default language. This is an exp

Daan de Lange 12 Apr 25, 2022
Markdownfield - Markdown field for SilverStripe

MarkdownField This module introduces a new DB field type Markdown & Markdown Editor. It uses github style Markdown style. And uses the simple markdown

SilverStripers 10 Jul 10, 2022
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

null 4 Jan 3, 2022
A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.

select2entity-bundle Introduction This is a Symfony bundle which enables the popular Select2 component to be used as a drop-in replacement for a stand

Ross Keatinge 214 Nov 21, 2022
Magento 2 extension. Strekoza_GoogleCategory. Add Category Attribute (field) - "Google Category"

Magento 2 extension. Strekoza_GoogleCategory Magento 2 extension. Add Category Attribute (field) - "Google Category" This exstension will add Category

Alex S 1 Feb 7, 2022
Nagios/Icinga plugin for checking SATEON field network device status

check_sateon Nagios/Icinga plugin for checking SATEON field network device status Max.Fischer [email protected] Tested on CentOS GNU/Linux 6.5 with Ici

null 1 May 27, 2022
Multi-language field export/import tool for ProcessWire

Language field export/import for ProcessWire Typically the way you translate page field values in ProcessWire is to edit a page, view the text in one

Ryan Cramer 3 Aug 19, 2022
Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service.

Turnstile for Silverstripe Adds a "spam protection" field to SilverStripe userforms using Cloudflare's Turnstile service. Maintainer Contact Ed Chipma

Webbuilders Group 3 Dec 15, 2022
Formcreator is a plugin which allow creation of custom forms of easy access

Formcreator is a plugin which allow creation of custom forms of easy access. At the same time, the plugin allow the creation of one or more tickets when the form is filled.

GLPI plugins 135 Dec 22, 2022