Sveltekit Search Params screenshot

Sveltekit Search Params

Author Avatar Theme by Paoloricciuti
Updated: 21 Apr 2025
600 Stars

The easiest way to read and WRITE from query parameters in sveltekit.

Categories

Overview

The sveltekit-search-params package is designed to provide a fast and efficient way to read and write query search parameters in SvelteKit. It is specifically built for use with Svelte-Kit and will not work in a normal Svelte project.

Features

  • Fast and Efficient: The package is designed to provide fast read and write operations for query search parameters in SvelteKit.
  • QueryParam Method: Import the queryParam method to easily retrieve specific search parameters from the URL.
  • Store Support: The queryParam method returns a store, allowing for automatic subscription and updating of the query parameter value.
  • Writing Query Parameters: The package allows for the easy writing of query parameters, treating the store like normal state in Svelte.
  • Encoding and Decoding: Query parameters can be transformed to and from different types, such as numbers, booleans, arrays, and complex objects, using encode and decode functions.
  • Default Values: Default values can be set for query parameters, ensuring they change only when necessary.

Installation

To install the sveltekit-search-params package, use the following command:

npm install sveltekit-search-params

Summary

The sveltekit-search-params package is a useful tool for handling query search parameters in SvelteKit. Its key features include fast read and write operations, store support, encoding and decoding of parameters, and the ability to set default values. It is specifically built for use with Svelte-Kit and offers efficient handling of query parameters.