Skip to main content
TrackSlider ← Back to Table of Contents

Summary

Track-based range slider with optional live value output. Also used internally for FieldType::Percentage and FieldType::RangeSlider.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\TrackSlider
State typeint|float
Model cast'volume' => 'integer' or 'float'
FieldTyperange_slider, percentage

Basic usage

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

TrackSlider::make('volume')
    ->label('Volume')
    ->min(0)
    ->max(100)
    ->step(5)
    ->suffix('%')
    ->trackLabel('Volume level')
    ->variant('secondary')
    ->showOutput()
    ->size('md');

Validation

No built-in min/max rules. Add manually:
->rule('min:0')
->rule('max:100')
Or define rules in FlexFieldDefinition.

Configuration API

min(int|float|Closure $min = 0) / max(int|float|Closure $max = 100)

Range boundaries.
TrackSlider::make('field_name')
    ->min(1)
    ->max(10);

step(int|float|Closure $step = 1)

Slider step increment.
TrackSlider::make('field_name')
    ->step(1);

integer(bool|Closure $condition = true)

Snap to integer values. Default: true.
TrackSlider::make('field_name')
    ->integer(true);

showOutput(bool|Closure $condition = true)

Display the current value. Default: true.
TrackSlider::make('field_name')
    ->showOutput(true);

suffix(string|Closure|null $suffix)

Text after the value, e.g. %, px.
TrackSlider::make('field_name')
    ->suffix('zł');

variant(string|Closure $variant)

ValueDescription
defaultStandard filled track.
secondarySubtle track styling.
TrackSlider::make('field_name')
    ->variant('primary');

decimalPlaces(int|Closure|null $places)

Decimal precision for displayed value.
TrackSlider::make('field_name')
    ->decimalPlaces(2);

trackLabel(string|Closure|null $label)

Accessible label / ARIA description for the track.
TrackSlider::make('field_name')
    ->trackLabel('Progress');

size(string|ControlSize|Closure $size)

See Control size.
TrackSlider::make('field_name')
    ->size('md');

FlexField schema config

Config keyMaps to
minmin()
maxmax()
stepstep()
sizesize()
variantvariant()
show_outputshowOutput()
suffixsuffix()
decimal_placesdecimalPlaces()
track_labeltrackLabel()
integerinteger()