@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
25 lines (24 loc) • 1.12 kB
text/typescript
import { Ref, UnwrapRef, WritableComputedRef } from 'vue';
export interface UseVModelOptions<T, Passive extends boolean = false> {
/**
* When passive is set to `true`, it will use `watch` to sync with props and ref.
* Instead of relying on the `v-model` or `.sync` to work.
*
* @default false
*/
passive?: Passive;
/**
* When eventName is set, it's value will be used to overwrite the emit event name.
*
* @default undefined
*/
eventName?: string[];
/**
* Defining default value for return ref when no value is passed.
*
* @default undefined
*/
defaultValue?: T;
}
export declare function useVModel<P extends object, K extends keyof P, Name extends string>(props: P, key?: K, emit?: (name: Name, ...args: any[]) => void, options?: UseVModelOptions<P[K], false>): WritableComputedRef<NonNullable<P[K]>>;
export declare function useVModel<P extends object, K extends keyof P, Name extends string>(props: P, key?: K, emit?: (name: Name, ...args: undefined[]) => void, options?: UseVModelOptions<P[K], true>): Ref<UnwrapRef<P[K]>>;