Skip to main content
← Back to Table of Contents

Summary

Single-select survey scale for Net Promoter Score (0–10), CSAT, satisfaction ratings, and textual Likert scales. Three visual variants share one API: pills (sliding segment control), segments (full-width bordered bar), and emojis (icon or image rings with labels). Works with all standard Filament field APIs: required(), disabled(), hidden(), live(), afterStateUpdated(), validation rules, etc.

Variants at a glance


Basic usage

Standard NPS (0–10)

Filament resource form

Color-coded NPS (Detractor / Passive / Promoter)


State & validation

Stored value

State is the option key from options() — not the display label.

Default: empty initial state

The field defaults to null. Nothing is selected until the user picks an option. All variants support this.
Set the initial value for a new form. Editing reads the saved model value:

Validation rules (built-in)

Optional fields — deselect on second click

When the field is not required(), clicking the already selected option clears the value back to null. Required fields always keep one selection.

Custom scales

5-point CSAT (1–5)

3-point quick rating

Textual Likert scale (string keys)

Dynamic options with a closure


Variant: Pills (default)

Sliding pill indicator on a gray track — same visual language as SegmentControl. Best for numeric scales and compact layouts.

Sizes

See Control size (sm, md, lg).

Rounding

Per-field rounding() overrides the global default from config/filament-flex-fields.php (ui.field_rounding).

Variant: Segments

Full-width bordered bar with vertical dividers between options. Ideal for 0–10 NPS and multi-option Likert rows.

Segments with sizes and rounding


Variant: Emojis

Circular rings with a visual inside each option and a text label below. Three ways to supply visuals (priority order):
  1. icons() — registered Blade icon names (Hugeicons and other installed sets)
  2. emojiImages() — custom image URLs
  3. Bundled webp — for numeric keys 0–4 when neither of the above is set

Bundled emoji images (5-point mood scale)

All five emoji images ship with the package and are published by php artisan filament:assets. Their URLs are resolved automatically from the current asset release and respect your filament.assets_path setting. You do not need to configure image paths.

Custom Hugeicons

Heroicon example:
When icons() is set for a key, it overrides bundled webp for that key.

Custom image URLs

Emoji sizes


Color coding & custom colors

Built-in NPS color coding

Custom per-option background colors

Map Filament semantic names, hex, or rgb to option keys:
With hex:

Custom selected text colors

With colorCoded() enabled, the built-in NPS palette takes priority. Leave it disabled when using your own colors() and textColors() mappings. Built-in tones apply only to exact scores from 0 through 10; textual scales remain neutral.

Disabled options

Disable individual keys without disabling the whole field. These keys are also rejected during server-side form validation, including direct submissions:
Dynamic:
Combine with field-level disabled():

Edge labels

Show helper text under the left and right ends of the scale:
Only the extremes are labeled — option labels come from options() values.

Complete configuration API

All methods accept Closure unless noted.

Public helper methods


Real-world examples

Resource examples use Filament\Schemas\Schema and Filament\Schemas\Components\Section. The textarea example uses Bjanczak\FilamentFlexFields\Filament\Forms\Components\FlexTextareaField. Reactive callbacks use Filament\Schemas\Components\Utilities\Get and Set.

Post-purchase survey (CreateRecord)

Wizard step — optional NPS

Live reactive form

Infolist / table display (manual)

NpsField is a form component. Display stored values in tables with TextColumn or a custom column:

Database & Eloquent

Migration

Model


Assets & deployment

Bundled emoji URLs include the asset release identifier, so updated images receive new URLs without manual cache busting. Publication updates the ready-to-use assets; no frontend build is required in your application. URLs provided through emojiImages() remain exactly as configured. On upgrade, run php artisan filament:assets, or include it in your deployment workflow. See Updating FLEX Fields.

Accessibility

  • Root element uses role="radiogroup" with aria-label from the field label.
  • Each option is one accessible radio button with aria-checked; there are no duplicate hidden radios.
  • Tab enters the selected option, or the first enabled option when empty. Arrow keys move selection, while Home and End select the first and last enabled options.
  • Enter and Space activate the focused option. Horizontal arrow direction follows RTL layouts.
  • Focus visible outline on keyboard navigation.
  • Disabled options expose aria-disabled="true" and are skipped by keyboard navigation.
  • Reduced-motion preferences disable the sliding and hover transitions.
  • On narrow screens, long pill scales scroll inside the field; keyboard selection keeps the active choice visible.

Performance

The NPS field reuses shared segment-control styles through its declared asset dependency. Shared styles are loaded once. Inactive tabs and closed modals wait for activation; each mounted field owns and releases its own interaction resources. Option nodes are collected once. Resize updates share one pending animation frame; segments and emoji variants do not allocate an indicator resize observer.

Playground

/admin/flex-fields/nps-field See Playground for setup.

CSS classes (reference)

Pills variant reuses fff-segment-control, fff-segment-track, fff-segment-indicator, and fff-segment-item from SegmentControl.
Last modified on October 16, 2026