Skip to main content
Your view runs for users on different devices and in different locales. useUser reports the user’s locale and device capabilities, so the view can format values and size controls for them.

Example

The carousel formats prices in the host locale and adapts its controls to the device: a touch device gets larger tap targets, and hover styles apply only when the device reports hover.

Returns

locale

The user’s language and region, canonical BCP 47. The hook canonicalizes what the host reports (underscores to hyphens, casing corrected, subtags preserved) and falls back to "en-US" when the value is not a valid locale. It is safe to pass straight to Intl APIs.

userAgent

The host’s device class and input capabilities.

useLayout

Read the host’s theme, available height, and safe-area insets

useDisplayMode

Read and request the view’s display mode

Design for the Host

Adapt the view to the user’s device and locale