Inspect Panel

A layer's specs and its code as CSS or a component, with copy, for handoff.

Habit card

Position
24px, 136px
Size
342px × 88px
Radius
16px
Fill
#FFFFFF
Shadow
0px 2px 8px 0px · #000000 10%
.habitCard {
  width: 342px;
  height: 88px;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0px 2px 8px 0px rgb(0 0 0 / 0.102);
}

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/inspect-panel

Usage

import { InspectPanel } from "./ui/uicontext/components/canvas/InspectPanel.ts"import type { Shape } from "./ui/uicontext/components/canvas/Scene.ts"
const Message = UiSchema.TaggedEnum({ PickedFormat: { format: Schema.Literals(["css", "jsx"]) } })export const Specs = (h: Html.H<typeof Message.Type>, shape: Shape | null, format: "css" | "jsx") =>	InspectPanel(h, { shape, format, onFormat: (f) => Message.PickedFormat({ format: f }) })

API reference

Options

InspectPanel options
NameTypeDescription
shaperequiredShape | null—
parentShape | nullThe frame the shape sits in, for its position
mainShapeAn instance's main component, for its code
formatrequired"css" | "jsx"—
onFormatrequired(format: CodeFormat) => Message—

Source