Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

PromptAction ​

Action controls for the Prompt toolbar: the action button PromptAction, the labeled switch PromptSwitch and the dropdown PromptSelect.

Basic Usage ​

Place the three controls in the toolbar slots of Prompt. PromptAction shows its text through label or the default slot, with the icon and suffix slots holding the icon and the trailing content; PromptSwitch controls its active state with v-model and shows a close entry while it is active; PromptSelect takes its options from options and keeps the selected value in v-model. All three are disabled together with the disabled and readonly states of the Prompt.

Ask anything
Hide source code

API ​

PromptActionProps ​

AttributeTypeOptionalDefaultDescriptionVersion
labelstringTrueThe text of PromptAction.0.2.1
disabledbooleanTruefalseWhether PromptAction is disabled.0.2.1

PromptActionSlots ​

SlotParameterDescriptionVersion
defaultThe text content of PromptAction.0.2.1
iconThe icon of PromptAction.0.2.1
suffixThe trailing content of PromptAction.0.2.1

PromptSwitchProps ​

AttributeTypeOptionalDefaultDescriptionVersion
labelstringTrueThe text of PromptSwitch.0.2.1
disabledbooleanTruefalseWhether PromptSwitch is disabled.0.2.1
modelValuebooleanTruefalseThe active state in controlled mode.0.2.1
defaultValuebooleanTruefalseThe initial active state in uncontrolled mode.0.2.1
showClosebooleanTruetrueWhether the close entry is shown while it is active.0.2.1

PromptSwitchEvents ​

EventParameterDescriptionVersion
update:modelValuevalue: booleanTriggered when the active state changes.0.2.1

PromptSwitchSlots ​

SlotParameterDescriptionVersion
defaultThe text content of PromptSwitch.0.2.1
iconThe icon of PromptSwitch.0.2.1

PromptSelectProps ​

AttributeTypeOptionalDefaultDescriptionVersion
disabledbooleanTruefalseWhether PromptSelect is disabled.0.2.1
options(string | PromptSelectOption | PromptSelectGroupOption)[]TrueThe data of the dropdown list.0.2.1
modelValueanyTrueThe selected value in controlled mode.0.2.1
defaultValueanyTrueThe initial selected value in uncontrolled mode.0.2.1
caretDurationnumberTrue250The duration of the animation of the dropdown caret.0.2.1
dropdownPropsOmit<PopupProps, 'visible' | 'defaultVisible' | 'content'> & EmitEvent<PopupEvents>TrueThe properties and events of the dropdown popup.0.2.1

PromptSelectEvents ​

EventParameterDescriptionVersion
update:modelValuevalue: anyTriggered when the selected value changes.0.2.1
opene: MouseEventTriggered when the dropdown list opens.0.2.1
closee: MouseEvent | TouchEvent | KeyboardEventTriggered when the dropdown list closes.0.2.1
selectvalue: any, option: string | PromptSelectOption, e: MouseEventTriggered when an option is chosen from the dropdown list.0.2.1

PromptSelectSlots ​

SlotParameterDescriptionVersion
defaultThe text content of PromptSelect.0.2.1
iconThe icon of PromptSelect.0.2.1
optionoption: string | PromptSelectOptionThe content of an option in the dropdown list.0.2.1
group-labeloption: PromptSelectGroupOptionThe content of a group label in the dropdown list.0.2.1

PromptSelectExpose ​

AttributeTypeOptionalDefaultDescriptionVersion
open() => voidFalseOpens the dropdown list.0.2.1
close() => voidFalseCloses the dropdown list.0.2.1

PromptSelectOption ​

ts
export interface PromptSelectOption extends OptionListOption {}

export interface PromptSelectGroupOption extends OptionListGroupOption {
	children: (PromptSelectOption | string)[]
}

OptionListOption, OptionListOption ​

ts
export interface OptionListOption<T = any> extends Option<T> {
	disabled?: boolean
	key?: string | number | symbol
}

export interface OptionListGroupOption extends GroupOption {
	label: string
	key: string | number | symbol
	children: (OptionListOption | string)[]
}

Option, GroupOption ​

ts
export interface Option<T = any> {
	value: T
	label: string
}

export interface GroupOption<T = any> {
	children: (Option<T> | string)[]
	type: 'group'
}

EmitEvent ​

ts
export type EmitEvent<T extends Record<string, any>> = {
	[K in keyof T as `on${Capitalize<K & string>}`]?: (...args: T[K]) => void
}

RestAttrs ​

ts
import type { StyleValue } from 'vue'

export type VueClassValue = string | Record<string, any> | VueClassValue[]
export type VueStyleValue = StyleValue

export type RestAttrs = {
	style?: VueStyleValue | null
	class?: VueClassValue | null
	[x: string]: any
}