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 fromoptions() — not the display label.
Default: empty initial state
The field defaults tonull. Nothing is selected until the user picks an option. All variants support this.
Validation rules (built-in)
Optional fields — deselect on second click
When the field is notrequired(), 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
sm, md, lg).
Rounding
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):icons()— registered Blade icon names (Hugeicons and other installed sets)emojiImages()— custom image URLs- Bundled webp — for numeric keys
0–4when neither of the above is set
Bundled emoji images (5-point mood scale)
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
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:Custom selected text colors
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:disabled():
Edge labels
Show helper text under the left and right ends of the scale:options() values.
Complete configuration API
All methods acceptClosure unless noted.
Public helper methods
Real-world examples
Resource examples useFilament\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"witharia-labelfrom the field label. - Each option is one accessible radio button with
aria-checked; there are no duplicate hidden radios. Tabenters the selected option, or the first enabled option when empty. Arrow keys move selection, whileHomeandEndselect the first and last enabled options.EnterandSpaceactivate 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.
Related components
CSS classes (reference)
Pills variant reuses
fff-segment-control, fff-segment-track, fff-segment-indicator, and fff-segment-item from SegmentControl.