{"id":13828075,"url":"https://github.com/inspheric/nova-indicator-field","last_synced_at":"2026-02-19T07:30:26.682Z","repository":{"id":38802618,"uuid":"146290750","full_name":"inspheric/nova-indicator-field","owner":"inspheric","description":"A colour-coded indicator field for Laravel Nova","archived":false,"fork":false,"pushed_at":"2022-05-18T17:23:50.000Z","size":240,"stargazers_count":130,"open_issues_count":5,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-12T23:43:06.709Z","etag":null,"topics":["laravel","laravel-nova","laravel-nova-field","laravel-package","nova"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inspheric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-27T11:53:54.000Z","updated_at":"2024-11-28T18:29:26.000Z","dependencies_parsed_at":"2022-09-12T01:50:44.199Z","dependency_job_id":null,"html_url":"https://github.com/inspheric/nova-indicator-field","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/inspheric/nova-indicator-field","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspheric%2Fnova-indicator-field","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspheric%2Fnova-indicator-field/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspheric%2Fnova-indicator-field/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspheric%2Fnova-indicator-field/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inspheric","download_url":"https://codeload.github.com/inspheric/nova-indicator-field/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inspheric%2Fnova-indicator-field/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29606748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-nova","laravel-nova-field","laravel-package","nova"],"created_at":"2024-08-04T09:02:31.076Z","updated_at":"2026-02-19T07:30:26.655Z","avatar_url":"https://github.com/inspheric.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Laravel Nova Indicator Field\nA colour-coded indicator field for Laravel Nova\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/inspheric/nova-indicator-field.svg?style=flat-square)](https://packagist.org/packages/inspheric/nova-indicator-field)\n[![Total Downloads](https://img.shields.io/packagist/dt/inspheric/nova-indicator-field.svg?style=flat-square)](https://packagist.org/packages/inspheric/nova-indicator-field)\n\n## Installation\n\nInstall the package into a Laravel app that uses [Nova](https://nova.laravel.com) with Composer:\n\n```bash\ncomposer require inspheric/nova-indicator-field\n```\n\n## Usage\n\nAdd the field to your resource in the ```fields``` method:\n```php\nuse Inspheric\\Fields\\Indicator;\n\nIndicator::make('Status'),\n```\n\nThe field extends the base `Laravel\\Nova\\Fields\\Field` field, so all the usual methods are available.\n\n### Options\n#### Labels\nAdd your desired status labels:\n\n```php\nIndicator::make('Status')\n    -\u003elabels([\n        'banned' =\u003e 'Banned',\n        'active' =\u003e 'Active',\n        'invited' =\u003e 'Invited',\n        'inactive' =\u003e 'Inactive',\n    ])\n```\n\nThe array key is the raw field value and the array value is the desired label.\n\nYou can, of course use the Laravel `trans()` or `__()` functions to translate the labels.\n\nIf a label is not defined for a value that appears in the field, the \"unknown\" label will be used (see below).\n\n#### Without Labels\n\nIf you do not need to specify a different label, you can simply display the raw field value:\n\n```php\nIndicator::make('Status')\n    -\u003ewithoutLabels()\n```\n\n#### Unknown Label\n\nSpecify the label when the raw field value does not correspond to one of the labels you defined:\n\n```php\nIndicator::make('Status')\n    -\u003eunknown('Unknown')\n```\n\nYou can, of course use the Laravel `trans()` or `__()` functions to translate the unknown label.\n\nIf this is not set, an em dash will be displayed instead.\n\nThis setting does not apply when `withoutLabels()` has been used. In that case, an unknown label will display with its raw value.\n\n#### Should Hide\n\nThe indicator can be hidden if the field value is equal to a given value(s) or a callback:\n\n```php\nIndicator::make('Status')\n    -\u003eshouldHide('active')\n```\n\n```php\nIndicator::make('Status')\n    -\u003eshouldHide(['invited', 'requested'])\n```\n\n```php\nIndicator::make('Status')\n    -\u003eshouldHide(function($value) {\n        return $value == 'inactive';\n    })\n```\n\nThis is useful if you only want to highlight particular values in the grid and hide others, e.g. you want banned users to be displayed with a red indicator and label, and for active (not banned) users, you don't want the indicator displayed at all.\n\n#### Should Hide If No\n\nThe indicator can be hidden if the field value is anything that PHP considers as falsy, i.e. `false`, `0`, `null` or `''`:\n\n```php\nIndicator::make('Status')\n    -\u003eshouldHideIfNo()\n```\n\nThis is a shortcut for a common scenario for the above `shouldHide()` method.\n\n#### Colours\n##### Named Colours\n\nAdd your desired status colours:\n\n```php\nIndicator::make('Status')\n    -\u003ecolors([\n        'banned' =\u003e 'red',\n        'active' =\u003e 'green',\n        'invited' =\u003e 'blue',\n        'inactive' =\u003e 'grey',\n    ])\n```\n\nThe array key is the raw field value and the array value is the desired colour.\n\nIf a colour is not specified for a status, it will be displayed as grey.\n\nThe available colours are the default \"base\" colours from [Tailwind](https://tailwindcss.com/docs/colors), with the addition of black:\n* 'black'   `#22292F`\n* 'grey' or 'gray' `#B8C2CC`\n* 'red'     `#E3342F`\n* 'orange'  `#F6993F`\n* 'yellow'  `#FFED4A`\n* 'green'   `#38C172`\n* 'teal'    `#4DC0B5`\n* 'blue'    `#3490DC`\n* 'indigo'  `#6574CD`\n* 'purple'  `#9561E2`\n* 'pink'    `#F66D9B`\n\nAs well as the following Nova variable colours:\n\n* 'success' `var(--success)`\n* 'warning' `var(--warning)`\n* 'danger'  `var(--danger)`\n* 'info'    `var(--info)`\n\nColour classes are not validated against the lists above, so if you enter an invalid colour, it will fall back to grey.\n\n##### Literal Colours\n\nYou can also use your own hexadecimal, RGB/RGBA or HSL/HSLA literal colours or variables, as in CSS:\n\n```php\nIndicator::make('Status')\n    -\u003ecolors([\n        '...' =\u003e '#ff0000',\n        '...' =\u003e 'rgb(0, 255, 0)',\n        '...' =\u003e 'rgba(0, 0, 0, 0.5)',\n        '...' =\u003e 'hsl(120, 100%, 50%)',\n        '...' =\u003e 'hsla(120, 100%, 50%, 0.5)',\n        '...' =\u003e 'var(--success)',\n    ])\n```\n\nLiteral colours are not validated, so if you enter an invalid CSS colour, it will fall back to grey.\n\n##### Additional Colour Classes\n\nIf you want to specify your own colours as reusable classes, you can serve your own CSS file using Nova's Asset functionality. The classes must be prefixed with `indicator-`:\n\n```css\n.indicator-yourcolourname {\n    background: #000000;\n}\n```\n\nWhich you would use in the field definition without the 'indicator-' prefix, as:\n\n```php\nIndicator::make('Status')\n    -\u003ecolors([\n        'yourstatus' =\u003e 'yourcolourname',\n    ])\n```\n\n## Appearance\n\nThe field is displayed similarly to the built-in `Laravel\\Nova\\Fields\\Boolean` field, with the ability to have more than a true/false value, and different labels and colours defined.\n\n### Index\n![index-field](https://raw.githubusercontent.com/inspheric/nova-indicator-field/master/docs/index-field.png)\n\n### Detail\n![detail-field](https://raw.githubusercontent.com/inspheric/nova-indicator-field/master/docs/detail-field.png)\n\n### Form\n(Same as detail.)\n\nThe indicator is not displayed on forms by default. If you choose to display it as a form field with `showOnUpdate()`, the indicator is not editable and does not write back to the server, as it is intended to come from a read-only or derived model attribute.\n\nIf you do need an editable status field, you might want to add your own additional `Laravel\\Nova\\Fields\\Select` field to your resource, referencing the same attribute name, and with `onlyOnForms()` set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspheric%2Fnova-indicator-field","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finspheric%2Fnova-indicator-field","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finspheric%2Fnova-indicator-field/lists"}