Skip to main content
← Back to Table of Contents

Summary

Styled wrapper around Filament’s Slider with SaaS-like track, step dots, server-rendered pips, fill segments, and formatted value display.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\FlexSlider
State typeint|float or [min, max] for range
FieldTypeflex_slider
ParentFilament\Forms\Components\Slider

Basic usage

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

FlexSlider::make('volume')
    ->range(0, 100)
    ->step(5)
    ->showValue()
    ->suffix('%')
    ->color('primary');

FlexSlider::make('price_range')
    ->range(0, 1000)
    ->step(10)
    ->fillTrack([false, true, false])
    ->prefix('$')
    ->trackLabel('Budget')
    ->decimalPlaces(0);
Range with auto-fill between handles:
FlexSlider::make('age_range')
    ->range(18, 80)
    ->step(1)
    ->autoFill()
    ->showValue()
    ->valuePosition('start');

State format

Same as Filament Slider: single numeric or array of two values for dual-handle range. Normalized via normalizeNumeric() respecting step() and decimalPlaces().

Validation

Inherits Filament Slider rules (min, max, step, etc.).

Configuration API (FlexSlider-specific)

showStepDots(bool|Closure $condition = true)

Renders indicator dots on the slider track corresponding to each step interval. Requires a step() to be defined.
FlexSlider::make('rating')
    ->min(1)
    ->max(5)
    ->step(1)
    ->showStepDots();

Inherited Filament Slider API

Also configure via parent methods:
MethodPurpose
range($min, $max)Bounds
step($step)Step increment
fillTrack(array|bool)Which segments are filled
decimalPlaces(int)Fixed decimal display
pips(PipsMode)Pip mode: Steps, Positions, Count, etc.
pipsValues(...) / pipsDensity(...)Pip configuration
vertical()Vertical orientation
rangePadding(...)Padding beyond min/max
default($value)Initial value
disabled() / nullable()State modifiers
See Filament Slider documentation for full parent API.

Public helper methods

MethodReturnsDescription
shouldShowValue()boolValue visible
getDisplayPrefix() / getDisplaySuffix()string|nullAffixes
getVariant()stringVariant name
getTrackLabel()string|nullHeader label
shouldHideThumbUntilInteraction()boolThumb hidden initially
getValuePosition()stringLabel position
shouldAutoFill()boolAuto fill segments
getColor() / getFillColor()string|nullColors
getNormalizedStateValues()list<float>Current handle values
isRangeState()boolRange mode
valueToPercent() / valueToRatio()floatPosition math
getInitialValueRatios()list<float>SSR thumb positions
formatDisplayValue(?float $value)stringFormatted label
shouldShowStepDots()boolStep dots visible
getStepDotRatios()list<float>Dot positions
shouldRenderServerPips()boolSSR pips mode
getServerRenderedPips()list<array>Pip markup data
resolveConnectForChrome()array|falseFill connection flags
getInitialFillSegments()list<array>SSR fill segments
normalizeNumeric(float|int $value)floatStep-aligned value

FlexField schema config

Config keyMaps to
min / maxrange()
stepstep()
sizesize()
variantvariant()
show_valueshowValue()
prefixprefix()
suffixsuffix()
track_labeltrackLabel()
hide_thumb_until_interactionhideThumbUntilInteraction()
value_positionvaluePosition()
fill_track / auto_fillfillTrack() / autoFill()
colorcolor()
fill_colorfillColor()
decimal_placesdecimalPlaces()

CSS classes

ClassRole
fff-flex-sliderRoot wrapper
fff-flex-slider--{sm|md|lg}Size modifier
fff-flex-slider--secondarySecondary variant
fff-flex-slider__railTrack hit area
fff-flex-slider__fillFilled segment
fff-flex-slider__thumbDraggable handle
fff-flex-slider__pipScale pip
fff-flex-slider__step-dotStep indicator dot
Uses CSS variables --fff-flex-slider-accent, --fff-flex-slider-value-ratio, etc.

Implementation notes

  • Server-rendered pips and fill segments reduce layout shift before Alpine hydrates.
  • Step dots capped at 11 visible dots (MAX_STEP_DOTS); excess steps are sampled.
  • Vertical sliders disable step dots and server pips.