Style Panel

A whiteboard's quick styles: color, fill, line, size, connector route and note color.

Note

Installation

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

Usage

import { StylePanel } from "./ui/uicontext/components/canvas/StylePanel.ts"import type { DrawStyle } from "./ui/uicontext/components/canvas/Viewport.ts"
const Message = UiSchema.TaggedEnum({ PickedStyle: { pick: Schema.Any } })export const Style = (h: Html.H<typeof Message.Type>, style: DrawStyle) =>	StylePanel(h, { value: style, onPick: (pick) => Message.PickedStyle({ pick }) })

API reference

Options

StylePanel options
NameTypeDescription
valuerequiredDrawStyle—
onPickrequired(pick: StylePick) => Message—
show{ readonly route?: boolean; readonly sticky?: boolean }Show what applies: connectors add the route, notes their color
styleStyleStyleX styles applied after the panel's own: a docked panel drops its float

Source