cookie
Imperative cookie helper with get, set, and delete.
3.3 KB
•Updated on September 3, 2026
Installation
Bash
pnpm dlx shadcn@latest add @spaceui/hooks-utils-cookieUsage
Code
import { setCookie, getCookie, deleteCookie } from '@/utils/cookie'
setCookie('theme', 'dark', 7)
const val = getCookie('theme')
deleteCookie('theme')API Reference
Parameters / Props
| Method | Parameters | Description |
|---|---|---|
get(name) | string | Returns cookie string or null. |
set(name, value, opts) | string, string, CookieOptions | Sets cookie. |
remove(name) | string | Deletes cookie. |
Return Value
Utility object with methods.