frontend/docs/adr/0001-widget-css-class-target-node.md
Date: 2026-06-16 Status: Accepted
We are adding a universal per-widget CSS class field (cssClass) so clients
can tag a widget and target it from the existing app/workspace Custom CSS. Every
rendered widget has two candidate "root" DOM nodes, and the client's CSS is
written against whichever one we choose:
WidgetWrapper (widget-${id}, WidgetWrapper.jsx:181) — carries
the layout engine: absolute positioning, width/height, drag/resize handles
(target, moveable-box).canvas-component _tooljet-{component} _tooljet-{name}
(RenderWidget.jsx:302) — the existing styling hook clients already target
(e.g. ._tooljet-button1 {}), wrapping the widget's visual content.This is hard to reverse: once clients ship CSS against the chosen node, moving the class to the other node silently breaks their styling.
Apply cssClass to the inner canvas-component node only.
Positive
_tooljet-* hooks clients already style against — the
custom class lands exactly where they expect.Negative / accepted