@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
13 lines • 905 B
text/typescript
import * as React from 'react';
/**
* Hook for specialized preference management for code demo variants and transformations.
* Builds on `useLocalStorageState` with intelligent storage key generation, prefix support,
* and automatic optimization for single-option scenarios.
*
* @param type - Type of preference, affects the storage key prefix
* @param name - Variant/transform name(s). Arrays are sorted and joined to form the storage key.
* Single-element arrays disable persistence (no choice to remember).
* @param initializer - Initial value or function returning initial value
* @returns A tuple of [preference, setPreference] for reading and updating the preference
*/
export declare function usePreference(type: 'variant' | 'transform', name: string | string[], initializer?: string | null | (() => string | null)): [string | null, React.Dispatch<React.SetStateAction<string | null>>];