videorc/ui

Pin Window Button

Keep on top, the pin every detached window shares. One name in every window, a filled pin while the window stays over other apps, a pressed state a screen reader hears, and a header or a status-bar look.

Notes

Pin Notes to keep it over other apps while you record.

Installation

$ pnpm dlx shadcn@latest add @videorc/pin-window-button

Usage

import { PinWindowButton } from "@/components/pin-window-button";
<PinWindowButton onPinnedChange={setAlwaysOnTop} pinned={alwaysOnTop} />

The window's state comes in through props. In Electron, ask the main process to call setAlwaysOnTop on the window, and pass back what it reports as pinned.

Use it for the one Keep on top control in a detached window: Notes, the Captions reader, Stream Manager. The header look sits in a Window Header.

Don't rename it per window or swap its icon, and don't put it in the main window.

Examples

In a status bar

variant="status-bar" is a Status Bar Action, for a window whose title row stays bare, such as Stream Manager.

Stream Manager

Theming

Token or attributeMeaning
Button ghost, size="icon"The header look
text-muted-foregroundUnpinned reads a tier quieter; hover brightens it
PinIconRegular while unpinned, filled while pinned
[-webkit-app-region:no-drag]Clickable on a header's drag band
data-testid="pin-window-button"On the button, in either look

Keyboard

KeyAction
Enter, SpacePins or unpins the window

Accessibility

It's named "Keep on top" (PIN_WINDOW_LABEL) in every window, with aria-pressed saying whether the window is pinned. A tooltip shows the name on hover, never a native title. Base UI's Tooltip needs no provider, so the button works in a window that has none; under one, it joins that window's delay group.

API reference

Prop

Type

PIN_WINDOW_LABEL is the control's one name, "Keep on top".