getClientWidth
Commons
stable
Returns the viewport width (window.innerWidth) in a browser context, or the SSR-provided clientWidth fallback when running server-side.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- ssrTSSROptions
- Optional SSR options object. When provided as an object with a clientWidth property, that value is returned instead of window.innerWidth.
API
Valeur de retour
La valeur retournée par cet util.
- The viewport width in pixels. Returns 0 when running server-side without an SSR options object.
Usage
Exemples
Extraits de code prêts à coller.
Viewport width in browser vs SSR