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

Example

The carousel follows the host theme, 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.

theme

The host’s active color theme. Mirror it in the view’s styling for a native feel. It updates when the user toggles the host theme.

userAgent

The host’s device class and input capabilities.

useViewport

Read the 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