> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# useUser

> Read the host's theme, locale, and device capabilities

Your [view](https://docs.skybridge.tech/build/view.md) runs for users on different devices, in different [locales](https://developer.mozilla.org/en-US/docs/Glossary/Locale), 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.

```tsx highlight={4-8,10,18} theme={null}
import { useUser } from "skybridge/web";

function Carousel({ products }: { products: Product[] }) {
  const { locale, theme, userAgent } = useUser();
  const isMobile = userAgent.device.type === "mobile";
  const canHover = userAgent.capabilities.hover;
  const isTouch = userAgent.capabilities.touch;

  const formatPrice = (amount: number) => {
    return new Intl.NumberFormat(locale, {
      style: "currency",
      currency: "USD",
    }).format(amount);
  };

  return (
    <div className={`${isMobile ? "grid-mobile" : "grid-desktop"} ${theme}`}>
      {products.map((product) => (
        <article
          key={product.id}
          className={canHover ? "card card-hoverable" : "card"}
        >
          <img src={product.image} alt={product.name} />
          <p>{product.name}</p>
          <p>{formatPrice(product.price)}</p>
          <button className={isTouch ? "buy buy-large" : "buy"}>
            Add to cart
          </button>
        </article>
      ))}
    </div>
  );
}
```

## Returns

### `locale`

```tsx theme={null}
locale: string;
```

The user's language and region, canonical [BCP 47](https://developer.mozilla.org/en-US/docs/Glossary/BCP_47_language_tag). 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`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) APIs.

### `theme`

```tsx theme={null}
theme: "light" | "dark";
```

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`

```tsx theme={null}
userAgent: UserAgent;
```

The host's device class and input capabilities.

```tsx theme={null}
type UserAgent = {
  device: {
    // "unknown" when the host reports no device class
    type: "mobile" | "tablet" | "desktop" | "unknown";
  };
  capabilities: {
    hover: boolean; // device supports hover interactions
    touch: boolean; // device supports touch input
  };
};
```

> [card] [useViewport](https://docs.skybridge.tech/api-reference/use-viewport.md)
>
> Read the available height and safe-area insets

> [card] [useDisplayMode](https://docs.skybridge.tech/api-reference/use-display-mode.md)
>
> Read and request the view's display mode

> [card] [Design for the Host](https://docs.skybridge.tech/guides/ux.md)
>
> Adapt the view to the user's device and locale


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.