Skip to main content
NumberStepper ← Back to Table of Contents

Summary

Pill-shaped numeric control with / + buttons and an animated NumberFlow display. Ideal for quantities, guests, or any numeric input where precise stepping is preferred over direct text entry.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\NumberStepper
State type`intfloatnullwhennullable()`
Model cast'quantity' => 'integer' or 'decimal:2'
FieldTypenumber_stepper
Playgroundnumber-stepper slug in Flex Fields playground
Works with all standard Filament field APIs: required(), disabled(), hidden(), live(), afterStateUpdated(), validation rules, etc.

Basic usage

Standard Quantity

use Bjanczak\FilamentFlexFields\Filament\Forms\Components\NumberStepper;

NumberStepper::make('quantity')
    ->label('Quantity')
    ->minValue(0)
    ->maxValue(99)
    ->step(1)
    ->suffix('kg');

Currency Input

NumberStepper::make('price')
    ->prefix('$')
    ->decimalPlaces(2)
    ->integer(false)
    ->step(0.5)
    ->minValue(0);

State & validation

Stored value

State is a numeric value (int or float) or null if nullable.
$record->quantity; // int|null — e.g. 5

Validation rules (built-in)

RuleWhen
integerWhen ->integer() (default: true)
min:$nWhen ->minValue($n) and not nullable()
max:$nWhen ->maxValue($n)
requiredWhen ->required()

Configuration API

All methods accept Closure unless noted.
MethodTypeDefaultDescription
minValue(scalar $value)SetupnullLower bound
maxValue(scalar $value)SetupnullUpper bound
step(int|float $step)Setup1Increment / decrement step
integer(bool $condition)SetuptrueRestrict to whole numbers
nullable(bool $condition)SetupfalseAllows null state
variant(string $variant)Setup'default'default, primary, secondary, tertiary, outline
prefix(string $prefix)SetupnullStatic text before the value
suffix(string $suffix)SetupnullStatic text after the value
nullLabel(string $label)Setup'—'Text shown when value is null
decrementIcon(string $icon)SetupconfigHeroicon for minus button
incrementIcon(string $icon)SetupconfigHeroicon for plus button
icons(array $icons)SetupShorthand for decrement and increment keys
reversed(bool $condition)SetupfalseSwaps button positions
decimalPlaces(int $places)SetupnullFixed decimal precision
wheelAnimated(bool $condition)SetuptrueEnable NumberFlow animation
size(string $size)Setup'md'sm, md, lg

Real-world examples

Guest Selection (Wizard)

NumberStepper::make('guests')
    ->label('Guests')
    ->helperText('Maximum 10 guests per reservation')
    ->minValue(1)
    ->maxValue(10)
    ->variant('primary')
    ->size('lg');

Reactive Price Calculator

NumberStepper::make('quantity')
    ->minValue(1)
    ->live()
    ->afterStateUpdated(fn (Set $set, $state) => $set('total', $state * 10.5));

Playground

/admin/flex-fields-playground/number-stepper See Playground for setup.
ComponentWhen to use instead
FlexSliderVisual range selection with a track
TrackSliderCompact track-based slider
FlexTextInputStandard text entry for large numbers

CSS classes (reference)

ClassRole
fff-number-stepperRoot wrapper
fff-number-stepper--{sm|md|lg}Size variant
fff-number-stepper--{variant}Visual variant
fff-number-stepper__valueValue container
fff-number-stepper__value-sizerHidden sizer for width stability
fff-number-stepper__value-displayVisible value wrapper
fff-number-stepper__ssr-valueServer-rendered initial value
fff-number-stepper__null-labelLabel for null state
fff-number-stepper__flowNumberFlow element
is-disabledDisabled state
is-reversedReversed layout