Skip to content

Description

Checkbox 組件用於選擇多個選項或切換單一選項的狀態,支援 checked、unchecked 和 indeterminate 三種狀態。

基本用法

Basic Checkbox

Checked: false

Value: false

帶標籤

Checkbox with Label

禁用狀態

Disabled Checkbox

不確定狀態

Indeterminate Checkbox

Parent: false
Children: []

群組用法

Checkbox Group

Choose your interests

Selected: [ "programming" ]

Choose colors (horizontal)

Selected: []

Choose languages (with disabled options)

Selected: [ "javascript" ]

API

Checkbox 屬性

屬性名說明類型默認值
modelValue當前選中狀態boolean | 'indeterminate' | null-
value複選框的值any-
name表單名稱string-
disabled是否禁用booleanfalse
required是否必填booleanfalse
inputIdinput 元素的 IDstring-
inputClassinput 元素的 classstring-
inputStyleinput 元素的樣式StyleValue-
binary是否為二進位模式booleanfalse
indeterminate是否為不確定狀態booleanfalse
label標籤文字string-

CheckboxGroup 屬性

屬性名說明類型默認值
modelValue當前選中的值陣列any[][]
options選項陣列(CheckboxOption | string)[][]
optionLabel選項標籤的屬性名string'label'
optionValue選項值的屬性名string'value'
optionDisabled選項禁用狀態的屬性名string'disabled'
disabled是否禁用整個群組booleanfalse
name表單名稱string-
orientation佈局方向'horizontal' | 'vertical''vertical'
label群組標籤string-

事件 Events

事件名說明回調參數
update:modelValue更新模型值(value: boolean | 'indeterminate' | null) => void
change值變更事件(event: Event) => void
focus獲得焦點事件(event: FocusEvent) => void
blur失去焦點事件(event: FocusEvent) => void

插槽 Slots

插槽名說明
default預設插槽
icon圖示插槽

Released under the MIT License.