{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "frame",
  "title": "Frame",
  "author": "zyx1121 (https://github.com/zyx1121)",
  "description": "A 1px outline that follows its parent's corners, with an optional label on the top edge and a detail on the bottom. Every window and field draws its edge with it.",
  "registryDependencies": [
    "https://ui.zyx.tw/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/zyx/components/ui/frame.tsx",
      "content": "import * as React from \"react\"\n\nimport { cn } from \"../../lib/utils\"\n\n// The outline of a window or a control: a 1px line on the parent's edge that\n// follows its corners (globals.css, Frames). The parent is positioned and sets\n// its radius; text-* sets the line color.\n// label sits on the top edge, detail on the bottom edge at the right.\nfunction FrameEdges({\n  className,\n  label,\n  detail,\n  ...props\n}: React.ComponentProps<\"span\"> & {\n  label?: React.ReactNode\n  detail?: React.ReactNode\n}) {\n  return (\n    <span\n      data-slot=\"frame-edges\"\n      className={cn(\"text-border\", className)}\n      {...props}\n    >\n      <span data-edge=\"top-left\" aria-hidden />\n      <span>\n        {label && (\n          <>\n            <span data-edge=\"lead\" aria-hidden />\n            <span data-frame-text>{label}</span>\n          </>\n        )}\n        <span data-edge=\"fill\" aria-hidden />\n      </span>\n      <span data-edge=\"top-right\" aria-hidden />\n      <span data-edge=\"side\" aria-hidden />\n      <span />\n      <span data-edge=\"side\" aria-hidden />\n      <span data-edge=\"bottom-left\" aria-hidden />\n      <span>\n        <span data-edge=\"fill\" aria-hidden />\n        {detail && (\n          <>\n            <span data-frame-text>{detail}</span>\n            <span data-edge=\"lead\" aria-hidden />\n          </>\n        )}\n      </span>\n      <span data-edge=\"bottom-right\" aria-hidden />\n    </span>\n  )\n}\n\n// One vertical edge, for a surface whose other edges are the viewport's.\nfunction FrameSide({\n  className,\n  side,\n  ...props\n}: React.ComponentProps<\"span\"> & { side: \"left\" | \"right\" }) {\n  return (\n    <span\n      data-slot=\"frame-side\"\n      data-side={side}\n      aria-hidden\n      className={cn(\"text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\n// A framed panel with a label on its edge, as a terminal dashboard draws one.\nfunction Frame({\n  className,\n  label,\n  detail,\n  children,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  label?: React.ReactNode\n  detail?: React.ReactNode\n}) {\n  return (\n    <div\n      data-slot=\"frame\"\n      className={cn(\"relative rounded-control px-4 py-4\", className)}\n      {...props}\n    >\n      {children}\n      <FrameEdges label={label} detail={detail} />\n    </div>\n  )\n}\n\n// The frame of a popup whose box scrolls: it sits in the positioner, beside\n// the popup, and fades with it.\nfunction WindowEdges() {\n  return (\n    <FrameEdges className=\"transition-opacity duration-overlay group-data-closed/window:opacity-0 starting:opacity-0\" />\n  )\n}\n\nexport { Frame, FrameEdges, FrameSide, WindowEdges }\n",
      "type": "registry:ui"
    }
  ],
  "css": {
    "[data-slot=\"frame-edges\"]": {
      "position": "absolute",
      "inset": "0",
      "z-index": "1",
      "border": "1px solid currentColor",
      "border-radius": "inherit",
      "pointer-events": "none",
      "user-select": "none"
    },
    "[data-slot=\"frame-edges\"] [data-edge]": {
      "display": "none"
    },
    "[data-slot=\"frame-edges\"] [data-frame-text]": {
      "position": "absolute",
      "padding-inline": "0.5ch",
      "background": "var(--background)",
      "color": "var(--muted-foreground)",
      "font-size": "var(--text-caption)",
      "line-height": "var(--text-caption--line-height)",
      "white-space": "pre"
    },
    "[data-slot=\"frame-edges\"] > :nth-child(2) [data-frame-text]": {
      "top": "calc(var(--text-caption--line-height) / -2)",
      "left": "1.5ch"
    },
    "[data-slot=\"frame-edges\"] > :nth-child(8) [data-frame-text]": {
      "bottom": "calc(var(--text-caption--line-height) / -2)",
      "right": "1.5ch"
    },
    "[data-slot=\"frame-side\"]": {
      "position": "absolute",
      "inset-block": "0",
      "width": "1px",
      "background": "currentColor",
      "pointer-events": "none"
    },
    "[data-slot=\"frame-side\"][data-side=\"left\"]": {
      "left": "0"
    },
    "[data-slot=\"frame-side\"][data-side=\"right\"]": {
      "right": "0"
    }
  },
  "meta": {
    "useWhen": "Drawing the outline of a window or a field in your own component.",
    "notFor": "Grouping page content; pages have no frames.",
    "related": [
      "dialog",
      "input"
    ]
  },
  "docs": "Use when: Drawing the outline of a window or a field in your own component.\nNot for: Grouping page content; pages have no frames.\nGuide: https://ui.zyx.tw/frame.md",
  "categories": [
    "content",
    "primitive"
  ],
  "type": "registry:ui"
}