GlassKit UI
Components

PermissionPrompt

An explicit access request (sensors, location, camera, mic) — which MRBD apps must ask for before use. A gradient-plate icon, a clear title, the reason, and allow / deny actions.

600 × 600 · live

Installation

npx @glasskit-ui/cli add permission-prompt

Install the SDK (it provides GlassViewport, useDpad and the stylesheet), then copy these files into your project:

npm install @glasskit-ui/react
// components/lib/utils.tsexport type ClassValue = string | number | null | undefined | false;/** * Join truthy class names. Dependency-free on purpose: the lens components * style via bespoke semantic classes (no conflicting Tailwind utilities to * de-dupe), so this needs no clsx/tailwind-merge and resolves from anywhere * the registry is vendored. */export function cn(...inputs: ClassValue[]): string {  return inputs.filter(Boolean).join(" ");}/** * Accessible name from a free-form `label` prop: the label itself when it's a * plain string, otherwise undefined (a ReactNode can't become an aria-label). */export function stringLabel(label: unknown): string | undefined {  return typeof label === "string" ? label : undefined;}
// components/glasskit/permission-prompt.tsx"use client";import type { ReactNode } from "react";import { FocusScope } from "@glasskit-ui/react";import { cn } from "../lib/utils";/** * <PermissionPrompt> — an explicit access request (sensors, location, camera, * mic), which MRBD apps must ask for before use. A gradient-plate icon, a clear * title, the reason, and allow / deny actions. Drop it into a <Screen> stage. * It's a dialog, so it renders inside a FocusScope: the D-pad ring is * contained to the prompt until it unmounts. */export function PermissionPrompt({  icon,  title,  children,  actions,  className,}: {  /** A gradient-plate <GlowIcon> for the capability. */  icon?: ReactNode;  title: ReactNode;  /** Why the app needs it (keep it short + honest). */  children?: ReactNode;  /** Allow / deny controls. */  actions?: ReactNode;  className?: string;}) {  return (    <FocusScope>      <div        className={cn("gk-permission", className)}        role="dialog"        aria-label={typeof title === "string" ? title : "Permission"}      >        {icon != null ? (          <span className="gk-permission__icon">{icon}</span>        ) : null}        <span className="gk-permission__title t-title">{title}</span>        {children != null ? (          <p className="gk-permission__body t-body">{children}</p>        ) : null}        {actions != null ? (          <div className="gk-permission__actions">{actions}</div>        ) : null}      </div>    </FocusScope>  );}

Usage

<PermissionPrompt  icon={<GlowIcon size="lg" plate tone="cyan"><LocationIcon /></GlowIcon>}  title="Use your location?"  actions={<><Button onClick={deny}>Not now</Button>            <Button variant="primary" onClick={allow}>Allow</Button></>}>  Maps needs your location for walking directions.</PermissionPrompt>

Props

Prop

Type