
Summary
iOS-style single-select segmented control.| Class | Bjanczak\FilamentFlexFields\Filament\Forms\Components\SegmentControl |
| State type | string|int — one option key |
| Model cast | 'alignment' => 'string' |
| FieldType | segment_control |
Basic usage
Validation
Built-inRule::in(...) against option keys.
Configuration API
options(array|Closure $options)
| Key | Type | Description |
|---|---|---|
label | string | Segment label |
icon | string|null | Heroicon (or use icons()) |
tooltip | string|null | Hover tooltip |
disabled | bool | Disables this segment |
'left' => 'Left'.
icons(array|Closure $icons)
Map of option key → Heroicon name.
disabledOptions(array|Closure $keys)
Disable segments by key.
variant(string|Closure $variant)
| Value | Description |
|---|---|
default | Filled track background. Default. |
ghost | Transparent track; uses color() for selection accent. |
color(string|Closure|null $color)
Selection accent color. For ghost, defaults to primary when omitted.
separators(bool|Closure $condition = true)
Vertical dividers between segments. Default: true.
fullWidth(bool|Closure $condition = true)
Stretch the control to the full field width.
iconOnly(bool|Closure $condition = true)
Hide labels; show icons only. Requires icons on options.
expandSelectedLabel(bool|Closure $condition = true)
Animates the selected segment to a wider width (label expansion).
size(string|ControlSize|Closure $size)
See Control size.
FlexField schema config
| Config key | Maps to |
|---|---|
options | options() |
size | size() |
variant | variant() |
full_width | fullWidth() |
icons | icons() |
disabled_options | disabledOptions() |
color | color() |
separators | separators() |
icon_only | iconOnly() |
expand_selected_label | expandSelectedLabel() |