Popover preview

Interactive preview of the CyberSpec Popover component. A key that opens a framed surface beside it, with a title, description and body.

About this preview

Popover belongs to the Overlays group in the CyberSpec catalog. It uses @ui-sdk/react/popover.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/popover.json

Example

"use client"

import { Popover } from "@/components/ui/popover"
import { Switch } from "@/components/ui/switch"

export default function PopoverDemo() {
  return (
    <>
      <Popover trigger="Route" title="Route details" description="Lowtide to Glasswater, by the Stacks underpass." code="ROUTE 07 // NODE 3F:A2">
        <dl>
          <div>
            <dt>Distance</dt>
            <dd>4.2 km</dd>
          </div>
          <div>
            <dt>Patrols</dt>
            <dd>2 on route</dd>
          </div>
          <div>
            <dt>Toll</dt>
            <dd>¤ 40</dd>
          </div>
        </dl>
        <Switch label="Avoid patrols" defaultChecked />
      </Popover>
      <Popover
        trigger="Toll"
        triggerTone="signal"
        side="top"
        align="end"
        title="Glasswater toll"
        description="Charged once per crossing by Vanta Systems. A Lowtide Union pass waives it."
        code="TARIFF 12 // REV 0.1"
      />
    </>
  )
}

Install this example

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/popover-demo.json

Resources

View as Markdown