Skip to content

Selectboxes

Selectboxes display options in a card/button-like layout, supporting single-selection (Radio) and multi-selection (Checkbox) modes.

Basic Usage (Single)

Use v-model for two-way binding. Only one option can be selected at a time by default.

Show Code
vue

<TSelectboxes v-model="selected">
  <TSelectboxItem value="apple" label="Apple" />
  <TSelectboxItem value="banana" label="Banana" />
  <TSelectboxItem value="orange" label="Orange" />
</TSelectboxes>

Multi-selection

Set multiple to enable checkbox mode. The bound value becomes an array.

Show Code
vue

<TSelectboxes v-model="selectedMulti" multiple>
  <TSelectboxItem value="vue" label="Vue" />
  <TSelectboxItem value="react" label="React" />
  <TSelectboxItem value="svelte" label="Svelte" />
  <TSelectboxItem value="angular" label="Angular" />
</TSelectboxes>

Pill Style

Set the pill prop for a more compact, rounded appearance.

Show Code
vue

<TSelectboxes v-model="selectedTag" pill>
  <TSelectboxItem value="design" label="Design" />
  <TSelectboxItem value="frontend" label="Frontend" />
  <TSelectboxItem value="backend" label="Backend" />
  <TSelectboxItem value="devops" label="DevOps" />
</TSelectboxes>

Custom Content (Slot)

Use the default slot on TSelectboxItem to customize each option with icons or rich content.

Show Code
vue

<TSelectboxes v-model="selectedPlatform">
  <TSelectboxItem value="ios">
    <span class="d-inline-flex align-items-center gap-2">
      <IconBrandApple :size="16" />
      <span>iOS</span>
    </span>
  </TSelectboxItem>
  <!-- ... -->
</TSelectboxes>

Options Array

Pass an array of strings or objects via the options prop to auto-generate TSelectboxItem children.

Show Code
vue

<TSelectboxes v-model="selectedOptions" :options="[
  { label: 'Alipay', value: 'alipay' },
  { label: 'WeChat Pay', value: 'wechat' },
  { label: 'UnionPay', value: 'unionpay', disabled: true },
]" />

API

TSelectboxes Props

PropDescriptionTypeDefault
v-modelSelected value (single: any, multi: array)any | any[]undefined
multipleMulti-selection (Checkbox) modebooleanfalse
pillPill/capsule stylebooleanfalse
disabledDisable all optionsbooleanfalse
nameNative name attributestringundefined
optionsOptions array (strings or objects); auto-generates TSelectboxItem(string | { label: string, value?: any, disabled?: boolean })[]undefined

TSelectboxes Emits

EventDescriptionParameters
update:modelValueEmitted when v-model changes(value: any | any[]) => void
changeEmitted when selection changes(value: any | any[]) => void

TSelectboxItem Props

PropDescriptionTypeDefault
valueOption valueany
labelLabel textstringundefined
disabledDisable this itembooleanfalse

TSelectboxes Slots

SlotDescriptionScoped Props
defaultCustom children (when options is not set)
optionCustom option label (when options is set){ option: { label, value, disabled }, checked: boolean }

TSelectboxItem Slots

SlotDescription
defaultCustom option content (overrides label prop)