Typed state in the URL
A ref bound to a query param. It writes the URL, and the URL writes it back.
The URL is the single source of truth for view state. Typed, reactive, and bound to your router.
Search, filters, sort, and pagination all belong in the query string. vuqs binds them to typed, reactive refs: you read values back as the types you declared, and write them like any ref.
<script setup lang="ts">
import { codecs, useQueryState } from '@vuqs/core'
const search = useQueryState('q', codecs.string.withDefault(''))
const page = useQueryState('page', codecs.integer.withDefault(1))
</script>
<template>
<input v-model="search" placeholder="Search…">
<button @click="page++">Next page</button>
<p>Searching “{{ search }}” on page {{ page }}</p>
</template>TIP
New here? Start with Installation, then read Concepts for codecs, params, schemas, and writes.