Skip to content

TimeZone

The TimeZone selector component provides a searchable dropdown for selecting IANA timezone identifiers. Supports alias search, custom aliases, and attribute forwarding via v-bind="$attrs".

Basic Usage

Use v-model to bind the selected IANA timezone code.

vue

<TTimeZone v-model="timezone" label="Select Timezone" />

Label & Description

Use label and description props for form labels and helper text. Clicking the label auto-focuses the input.

vue

<TTimeZone
  v-model="timezone"
  label="Work Timezone"
  description="Used to display all time-related data"
/>

Search Filtering

Type to filter by city, timezone code, or UTC offset. Supports Chinese alias search — try Shanghai or Tokyo. Keyboard ↑↓ navigation and Enter to select.

vue

<TTimeZone v-model="timezone" label="Search Timezone" />

Attribute Forwarding

Undeclared attributes (e.g. size, validation, prepend-text, block) are automatically forwarded to the inner TCombobox via v-bind="$attrs".

vue

<TTimeZone v-model="timezone" label="Small size" size="sm" validation="valid" />

Custom Aliases

Inject business-specific search aliases via the custom-aliases prop. Users can find timezones by typing custom keywords.

vue

<TTimeZone
  v-model="timezone"
  label="Search Timezone"
  :custom-aliases="{
    'Asia/Shanghai': ['mycity', 'shanghai'],
    'America/New_York': ['nyc', 'bigapple'],
  }"
/>

API

Props

PropDescriptionTypeDefault
v-modelSelected IANA timezone codestring''
labelLabel textstringundefined
descriptionDescription textstringundefined
placeholderSearch placeholderstring'搜索时区...'
disabledDisable the inputbooleanfalse
requiredMark as requiredbooleanfalse
customAliasesCustom search aliasesRecord<string, string[]>{}

Forwarded Attributes

These attributes are forwarded to the inner TCombobox via v-bind="$attrs":

AttributeDescriptionType
sizeInput size'sm' | 'lg'
validationValidation state'valid' | 'invalid'
blockFull widthboolean
prependTextPrepended textstring
appendTextAppended textstring