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.
994 B
994 B
category
| category |
|---|
| @Math |
useClamp
Reactively clamp a value between two other values.
Usage
import { useClamp } from '@vueuse/math';
const min = shallowRef(0);
const max = shallowRef(10);
const value = useClamp(0, min, max);
You can also pass a ref and the returned computed will be updated when the source ref changes:
import { useClamp } from '@vueuse/math';
const number = shallowRef(0);
const clamped = useClamp(number, 0, 10);
Type Declarations
/**
* Reactively clamp a value between two other values.
*
* @see https://vueuse.org/useClamp
* @param value number
* @param min
* @param max
*
* @__NO_SIDE_EFFECTS__
*/
export declare function useClamp(
value: ReadonlyRefOrGetter<number>,
min: MaybeRefOrGetter<number>,
max: MaybeRefOrGetter<number>,
): ComputedRef<number>;
export declare function useClamp(
value: MaybeRefOrGetter<number>,
min: MaybeRefOrGetter<number>,
max: MaybeRefOrGetter<number>,
): Ref<number>;