Skip to main content
← Back to Table of Contents

Summary

Searchable IANA timezone picker with a Gravity UI clock icon on the trigger and in menu rows. Stores a single timezone identifier string.
ClassBjanczak\FilamentFlexFields\Filament\Forms\Components\TimezoneField
State typestring|null — IANA timezone identifier
Model cast'timezone' => 'string'
FieldType(no dedicated FieldType mapping yet — use the class directly)
Playgroundtimezone-field slug in Flex Fields playground

Basic usage

Standard timezone picker

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

TimezoneField::make('timezone')
    ->label('User Timezone')
    ->defaultTimezone('Europe/Warsaw')
    ->showOffset()
    ->required();

Browser-aware detection

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

TimezoneField::make('timezone')
    ->browserTimezoneDefault()
    ->browserTimezoneSortFirst();

State & validation

Stored value

State is a single IANA identifier string.
$record->timezone; // string|null — e.g. "Europe/Warsaw"

Validation rules

Built-in validation ensures the submitted identifier is in the resolved timezone list.
RuleDetail
nullableAlways (unless required())
in(...)Value must match a configured IANA identifier

Configuration API

All methods accept Closure unless noted.
MethodTypeDefaultDescription
timezones(array|Closure|null $timezones)SetupnullWhitelist of IANA identifiers
exceptTimezones(array|Closure $timezones)Setup[]Blacklist of IANA identifiers
defaultTimezone(string|Closure|null $timezone)SetupnullFallback IANA identifier
browserTimezoneDefault(bool|Closure $condition = true)SetupfalsePre-select from browser settings
browserTimezoneSortFirst(bool|Closure $condition = true)SetupfalseSort browser timezone to top of list
showOffset(bool|Closure $condition = true)SetuptrueShow UTC offset badge (e.g. UTC+02:00)
searchable(bool|Closure $condition = true)SetuptrueShow search input in dropdown
prefixIcon(...)SetupClockCustom leading icon
variant(string|Closure $variant)Setup'primary'Visual style: primary, secondary, flat, soft
size(string|ControlSize|Closure $size)Setup'md'Control size: sm, md, lg
rounding(string|Closure|null $rounding)SetupconfigBorder radius token

timezones() / exceptTimezones()

Limit the list to specific regions or exclude problematic zones:
TimezoneField::make('timezone')
    ->timezones(['UTC', 'Europe/Warsaw', 'America/New_York'])
    ->exceptTimezones(['GMT']);

browserTimezoneDefault()

When enabled and state is empty, it attempts to detect the user’s timezone via Alpine/JS.
TimezoneField::make('timezone')->browserTimezoneDefault();

Real-world examples

User profile settings

public static function form(Form $form): Form
{
    return $form->schema([
        TimezoneField::make('timezone')
            ->label('Your local time')
            ->browserTimezoneDefault()
            ->browserTimezoneSortFirst()
            ->required(),
    ]);
}

Event scheduler

TimezoneField::make('event_timezone')
    ->label('Event Location Timezone')
    ->searchable()
    ->showOffset();

Playground

/admin/flex-fields-playground/timezone-field See Playground for setup.
ComponentWhen to use instead
CountryFieldFor picking a country instead of a specific timezone
FlexDateTimePickerFor picking a date/time with optional timezone support
SelectFieldFor a generic dropdown if IANA identifiers aren’t needed

CSS classes (reference)

ClassRole
fff-timezone-fieldRoot wrapper
fff-timezone-field--{sm|md|lg}Size modifier
fff-timezone-field__triggerPicker button
fff-timezone-field__offsetUTC offset badge
fff-timezone-field__menuDropdown panel
fff-timezone-field__searchSearch input

Performance

MechanismWhat it does
Virtual ScrollEfficiently renders long lists of timezones (~400+ zones)
SSR LabelRenders the selected timezone label server-side for zero layout flash
TeleportUses x-teleport="body" to avoid overflow clipping in modals