PaceUI

  • Components
  • Blocks
  • Templates
  • Studio
  • Resources
Native AI
  • Introduction
Components
  • Browser Support
  • Response Renderer
  • Chat Header
  • Chat Messages
  • Chat Suggestions
  • Chat Input
Use Cases
  • Quick Chat
  • Follow Ups
Hooks
  • useBrowserSupport
  • useNativeAI
  1. Components
  2. Native AI
PreviousNext

useBrowserSupport

React hook to detect Chrome Built-in AI availability.

Overview

The useBrowserSupport hook queries the browser to check whether Chrome Built-in AI (window.ai / LanguageModel) is available natively. It identifies the client's browser, provides helpful error reasons if unsupported, and offers a recheck method to dynamically update support status without a full page reload.

Installation

NPM
pnpm
Yarn
Bun
npm install npx shadcn@latest add @paceui/native-ai-use-browser-support

Usage

Here is a basic example of checking browser AI support and displaying status badges or fallback alerts:

SupportCheck.tsx
import { useBrowserSupport } from "@/hooks/native-ai/use-browser-support";

export function SupportCheck() {
  const { isSupported, isLoading, detectedBrowser, errorReason, recheck } = useBrowserSupport();

  if (isLoading) {
      return <div>Checking browser AI support...</div>;
  }

  return (
      <div className="p-4 border rounded-md">
          <p><strong>Browser:</strong> {detectedBrowser}</p>
          <p><strong>Status:</strong> {isSupported ? "Supported" : "Unsupported"}</p>
          {errorReason && <p className="text-red-500">{errorReason}</p>}
          <button onClick={recheck} className="mt-2 px-3 py-1 border rounded">
              Re-check Support
          </button>
      </div>
  );
}

API Reference

Returns

PropertyTypeDescription
isLoadingbooleantrue while the hook is actively querying browser capabilities.
isSupportedbooleantrue if native Chrome Built-in AI (window.ai) is available on the client.
isMobilebooleantrue if client is a mobile device (mobile devices are not supported yet).
engine"chrome-native" | nullThe active AI engine type, or null if unsupported.
errorReasonstring | undefinedDescriptive reason explaining why local AI support is currently unavailable.
detectedBrowserBrowserTypeDetected browser identifier ("chrome" | "firefox" | "edge" | "safari").
canEnablebooleantrue if the detected browser supports enabling native AI flags (e.g. Chrome).
recheck() => Promise<void>Function to trigger a manual re-evaluation of browser AI support.

Exported Helpers & Types

helpersAndTypes.ts
export type BrowserType = "chrome" | "firefox" | "edge" | "safari";

export type AIEngine = "chrome-native" | "polyfill-webllm";

export const SUPPORTED_NATIVE_BROWSERS: BrowserType[] = ["chrome"];

export function detectMobile(): boolean;

export function detectBrowser(): BrowserType;
Follow UpsuseNativeAI

PaceUI

Animated blocks, components, and templates for Next.js and TanStack Start. Built with Motion and shadcn - clean code you own.

GitHubTwitterDiscord

Products

BlocksComponentsTemplatesCraftsTanStack ChartsMCP ServerStarter KitsStyleX Components

Resources

DocumentationMotion ComponentsGSAP AnimationsNative AIBlogChangelog

Pricing & Account

PricingManage AccountLicensesAPI KeysAffiliate Program

Company

Contact UsDiscord CommunityPrivacy PolicyTerms of Service

© 2026 PaceUI. All rights reserved. Built by indie developer, Denish

PACEUI