Nasaq

ExtensionPopup

Browser extension surfaces, a popup with connect and pair, mini status cards, a pause switch and quick actions, plus an options page with a save bar.

PreviewOpen ↗

Code

import { ExtensionMiniCard, ExtensionPopup } from "@fadymondy/nasaq/web";export function Popup() {  return (    <ExtensionPopup brand="Nasaq" status="connected" paused={false} onPausedChange={() => {}}>      <ExtensionMiniCard title="Today" value="12" hint="tasks" />    </ExtensionPopup>  );}

Apps & Platforms · beta

Live examples and controls: ExtensionPopup in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/extension-popup.json

The small surfaces of a browser extension. ExtensionPopup is the 360px popup frame with a brand, a connection badge, a pause switch and a footer. ExtensionConnect signs in to a server or pairs with a code. Inside the popup use ExtensionMiniCard and ExtensionQuickActions. ExtensionOptionsPage and ExtensionOptionRow build the options page with a save bar.

When to use

  • The popup, sign-in and options page of a browser extension.
  • Any compact companion window that shows a few live numbers and actions.

When not to use

Import

import { ExtensionConnect, ExtensionMiniCard, ExtensionPopup } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

import { ExtensionMiniCard, ExtensionPopup } from "@fadymondy/nasaq/web";

export function Popup() {
  return (
    <ExtensionPopup brand="Nasaq" status="connected" paused={false} onPausedChange={() => {}}>
      <ExtensionMiniCard title="Today" value="12" hint="tasks" />
    </ExtensionPopup>
  );
}

Anatomy

ExtensionPopup                  data-slot="extension-popup"
├─ header                       brand, status Badge
├─ pause row                    Switch
├─ children                     mini cards, quick actions
└─ footer                       version, options link
ExtensionConnect                server address or pairing code form
ExtensionOptionsPage            sections of ExtensionOptionRow and a save bar

API

ExtensionPopup

PropTypeDefaultDescription
brand?ReactNodenoneLogo and name.
status?"connected" | "disconnected" | "error""connected"Badge state.
paused? / onPausedChange?boolean / (paused) => voidnoneShows the pause switch when given.
onOpenOptions?() => voidnoneOptions link in the footer.
footer?ReactNodenoneReplaces the footer.
labels?ExtensionPopupLabelsbuilt-in en/arString overrides.

ExtensionConnect

PropTypeDefaultDescription
mode?"server" | "pair""server"Address form or pairing code.
defaultServer?string""Starting address.
onConnect(values) => Promise<void | { error?: string }>requiredReturn an error string to show it.

isServerAddress(value) is the validator the form uses.

Other parts

ExtensionMiniCard (title, icon, status, value, hint), ExtensionQuickActions (actions, columns), ExtensionOptionsPage (title, description, brand, sections, onSave, dirty), ExtensionOptionRow (label, description, control).

Examples

Pair mode asks for a code; the story shows the failing path when the address contains "fail".

Accessibility

Errors are announced in a live region, the pause switch is labelled, and quick actions are buttons.

RTL & i18n

Logical spacing throughout. Server addresses and codes are set ltr. Strings via useOptionalNasaq().

Styling & tokens

Only --nq-* tokens. The popup width is 360px; override with className.

Do / Don't

  • Do return { error } from onConnect instead of throwing.
  • Don't put more than four quick actions in the popup.

Switch, Field, glance-surfaces.

Lab

Pages / App / Extension Popup in the lab: Default, Arabic, Mobile.

On this page