Files
stack/packages/mosaic/framework/skills/vueuse-functions/references/refAutoReset.md
T
fargo 1a822493ba format: apply repo prettier (3.8.1) to the folded skills tree
963 markdown files reformatted with the repository's pinned prettier so
pnpm format:check covers the folded tree like every other repo file.

The formatter's embedded-language pass also normalized code fences
(TS semicolons, closed HTML tags in examples, lowercased CSS hex colors,
one renumbered list that skipped an index). Alphanumeric token deltas vs
the fold commit were audited file-by-file; all are formatter-equivalent
markup normalizations plus the four sanitized skills.
2026-08-19 14:37:17 -05:00

1.1 KiB

category, alias
category alias
Reactivity autoResetRef

refAutoReset

A ref which will be reset to the default value after some time.

Usage

import { refAutoReset } from '@vueuse/core';

const message = refAutoReset('default message', 1000);

function setMessage() {
  // here the value will change to 'message has set' but after 1000ms, it will change to 'default message'
  message.value = 'message has set';
}

::: info You can use triggerRef to trigger effects after making deep mutations to the inner value of a refAutoReset. :::

Type Declarations

export type RefAutoResetReturn<T = any> = Ref<T>;
/**
 * Create a ref which will be reset to the default value after some time.
 *
 * @see https://vueuse.org/refAutoReset
 * @param defaultValue The value which will be set.
 * @param afterMs      A zero-or-greater delay in milliseconds.
 */
export declare function refAutoReset<T>(
  defaultValue: MaybeRefOrGetter<T>,
  afterMs?: MaybeRefOrGetter<number>,
): RefAutoResetReturn<T>;
/** @deprecated use `refAutoReset` instead */
export declare const autoResetRef: typeof refAutoReset;