COMPONENT REFERENCEVisual control

ResponsiveGrid

An ordered grid with separate wide and narrow column counts.

kind: responsivegridJavaScript + C#Implemented

What it does

An ordered grid with separate wide and narrow column counts.

This is a visual component. Drag it from Toolbox, or double-click to insert it.

Set it up

  1. Add ResponsiveGrid from Toolbox.
  2. Set its Name to sample for the examples below. Names are case-sensitive.
  3. Configure the component-specific properties below.
  4. Open the Events inspector to add a handler: methods go in event.js, imports and subscriptions in script.js. Right-click View Events or View Script to edit either file. Use View CSS for scoped styles and View Custom Properties for JSON values.
  5. Save sources, save the project, and open a fresh Preview. Scripts execute in Preview.

JavaScript example

These examples use supported inline subscriptions for brevity. The Events inspector can generate separate class methods in event.js instead.

Drop children into the grid; child order defines placement. Wide columns apply at or above the breakpoint, narrow columns below it. Width is measured on the container, not the window. Grid owns child width; resize height or drag to reorder.

forma.on("Load", () => {
  forma.set("sample", "columns", 3);
  forma.set("sample", "narrowColumns", 1);
  forma.set("sample", "breakpoint", 600);
  forma.set("sample", "gap", 12);
});

Component properties

FieldInspector keyEditorAccepted values / rangeRuntime key
Gapgapnumber0–64gap
Breakpoint (px)breakpointnumber100–2400breakpoint
Wide columnscolumnsnumber1–12columns
Narrow columnsnarrowColumnsnumber1–12narrowColumns

Runtime property API

Use forma.get("sample", key), forma.set("sample", key, value), or forma.bind("sample", key). Read a binding with .value; write only when the Binding column permits it. Numbers and booleans must keep their types. Arrays are passed directly, not as JSON strings.

KeyValue typegetsetBindingMeaning / restrictions
textstringYesYesRead/writeDisplay text; use value to read live text input.
enabledbooleanYesYesRead/writeEnabled
visiblebooleanYesYesRead/writeVisible
tagstringYesYesRead/writeTag
xnumberYesYesRead/writeParent-content X coordinate. Writes are rejected for managed/docked children.
ynumberYesYesRead/writeParent-content Y coordinate. Writes are rejected for managed/docked children.
widthnumberYesYesRead/writeConfigured model width; managed layouts/custom CSS can change rendered size.
heightnumberYesYesRead/writeConfigured model height; managed layouts/custom CSS can change rendered size.
minimumWidthnumberYesYesRead/writeRange 0–1600. Invalid types are rejected; numeric values clamp.
minimumHeightnumberYesYesRead/writeRange 0–1200. Invalid types are rejected; numeric values clamp.
maximumWidthnumberYesYesRead/writeRange 0–1600. Invalid types are rejected; numeric values clamp.
maximumHeightnumberYesYesRead/writeRange 0–1200. Invalid types are rejected; numeric values clamp.
backColorstringYesYesRead/writeBackground
foreColorstringYesYesRead/writeForeground
borderStyle"none" | "solid" | "dashed" | "dotted"YesYesRead/writeBorder style
borderColorstringYesYesRead/writeBorder color
borderWidthnumberYesYesRead/writeRange 0–10. Invalid types are rejected; numeric values clamp.
borderSides"all" | "none" | "top" | "bottom" | "left" | "right" | "top,bottom" | "left,right" | "top,left,right" | "bottom,left,right"YesYesRead/writeBorder sides
borderRadiusnumberYesYesRead/writeRange 0–100. Invalid types are rejected; numeric values clamp.
opacitynumberYesYesRead/writeRange 10–100. Invalid types are rejected; numeric values clamp.
shadow"None" | "Small" | "Medium" | "Large"YesYesRead/writeShadow
cursor"default" | "pointer" | "text" | "crosshair" | "help" | "not-allowed"YesYesRead/writeCursor
fontFamily"Segoe UI" | "Arial" | "Consolas" | "Georgia"YesYesRead/writeFont family
fontSizenumberYesYesRead/writeRange 8–48. Invalid types are rejected; numeric values clamp.
fontWeight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"YesYesRead/writeWeight
fontStyle"normal" | "italic"YesYesRead/writeFont style
textAlign"left" | "center" | "right"YesYesRead/writeAlignment
lineHeightnumberYesYesRead/writeRange 0.5–4. Invalid types are rejected; numeric values clamp.
letterSpacingnumberYesYesRead/writeRange -5–20. Invalid types are rejected; numeric values clamp.
marginTopnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
marginRightnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
marginBottomnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
marginLeftnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
paddingTopnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
paddingRightnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
paddingBottomnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
paddingLeftnumberYesYesRead/writeRange 0–64. Invalid types are rejected; numeric values clamp.
focusablebooleanYesYesRead/writeFocusable
tabIndexnumberYesYesRead/writeRange 0–32767. Invalid types are rejected; numeric values clamp.
toolTipstringYesYesRead/writeTooltip
cssClassstringYesYesRead/writeCSS class
layoutSlotnumberYesYesRead/writeOne-based parent pane, page, or table cell.
columnsnumberYesYesRead/writeDataGridView: string array; TableLayoutPanel/ResponsiveGrid: column count.
narrowColumnsnumberYesYesRead/writeResponsiveGrid column count below its breakpoint (1-12).
breakpointnumberYesYesRead/writeContainer width below which the narrow layout applies.
gapnumberYesYesRead/writeSpacing between managed children in pixels.
dock"none" | "top" | "bottom" | "left" | "right" | "fill"YesYesRead/writeParent-managed edge/fill layout. Takes priority over Anchor.
anchor"none" | "top,left" | "top,right" | "bottom,left" | "bottom,right" | "top,left,right" | "bottom,left,right" | "top,bottom,left" | "top,bottom,right" | "top,bottom,left,right" | "top" | "bottom" | "left" | "right" | "top,bottom" | "left,right"YesYesRead/writeComma-separated edges; opposite edges stretch. Use exact option strings.

Set commands cross the native bridge asynchronously. An immediate get after set may return the previous value. Observe a binding or use the assigned value locally. Getter arrays are copies. Geometry is configured model geometry; layout and CSS may override rendered bounds.

Shared inspector fields

FieldInspector keyEditorAccepted values / rangeRuntime key
Namenametext—Designer only
ID (read-only)idtext—Designer only
Text / Titletexttext—text
Tagtagtext—tag
Lockedlockedcheckbox—Designer only
BackgroundbackColorcolor—backColor
ForegroundforeColorcolor—foreColor
Border styleborderStyleselectnone, solid, dashed, dottedborderStyle
Border colorborderColorcolor—borderColor
Border widthborderWidthnumber0–10borderWidth
Border sidesborderSidesselectall, none, top, bottom, left, right, top,bottom, left,right, top,left,right, bottom,left,rightborderSides
RadiusborderRadiusnumber0–100borderRadius
Opacity (%)opacitynumber10–100opacity
ShadowshadowselectNone, Small, Medium, Largeshadow
Cursorcursorselectdefault, pointer, text, crosshair, help, not-allowedcursor
Font familyfontFamilyselectSegoe UI, Arial, Consolas, GeorgiafontFamily
Font sizefontSizenumber8–48fontSize
WeightfontWeightselectnormal, bold, 100, 200, 300, 400, 500, 600, 700, 800, 900fontWeight
Font stylefontStyleselectnormal, italicfontStyle
AlignmenttextAlignselectleft, center, righttextAlign
Line heightlineHeightnumber0.5–4lineHeight
Letter spacingletterSpacingnumber-5–20letterSpacing
Xxnumber0–1600x
Yynumber0–1200y
Widthwidthnumber24–1600width
Heightheightnumber20–1200height
Min widthminimumWidthnumber0–1600minimumWidth
Min heightminimumHeightnumber0–1200minimumHeight
Max width (0=auto)maximumWidthnumber0–1600maximumWidth
Max height (0=auto)maximumHeightnumber0–1200maximumHeight
Margin topmarginTopnumber0–64marginTop
Margin rightmarginRightnumber0–64marginRight
Margin bottommarginBottomnumber0–64marginBottom
Margin leftmarginLeftnumber0–64marginLeft
Padding toppaddingTopnumber0–64paddingTop
Padding rightpaddingRightnumber0–64paddingRight
Padding bottompaddingBottomnumber0–64paddingBottom
Padding leftpaddingLeftnumber0–64paddingLeft
Enabledenabledcheckbox—enabled
Visiblevisiblecheckbox—visible
Focusablefocusablecheckbox—focusable
Tab indextabIndexnumber0–32767tabIndex
TooltiptoolTiptext—toolTip
CSS classcssClasstext—cssClass
Pane / tab / celllayoutSlotnumber1–100layoutSlot
Dockdockselectnone, top, bottom, left, right, filldock
Anchoranchorselectnone, top,left, top,right, bottom,left, bottom,right, top,left,right, bottom,left,right, top,bottom,left, top,bottom,right, top,bottom,left,right, top, bottom, left, right, top,bottom, left,rightanchor

Events and lifecycle

Component hooks: Relevant DOM events and shared lifecycle events.

Only applicable browser events fire: a control without text input will not produce native input events just because a handler is registered. Event names are case-insensitive. Put handlers on the component producing the event; a Timer Tick handler belongs to the Timer, or can be observed through forma.root.on("Tick", handler). See the event guide for payloads, validation, cleanup, and startup order.

Property-change payload

All components can report PropertyChanged for changed projected runtime properties. Handlers expose source/subscriber component handles; native DOM targets remain available. Input/Change can supply typed property values, while Click normally supplies identity without a property/value pair.

forma.on("PropertyChanged", ({ source, property, value, previousValue, origin }) => {
  console.log(source.name, property, previousValue, "→", value, origin);
});

Use forma.root.on(...) to observe the active form, and event.toJSON() for portable logs. Subscriptions return unsubscribe and are cleaned up with the subscribing script.

C# example

Use this in a configured Forma C# host, not in script.js. The renderer is your host's WebView2Renderer instance.

var sample = new Forma.Core.Controls.ResponsiveGrid
{
    Name = "sample"
};
await renderer.RenderAsync(sample);

C# model reference

These are Core constructor defaults, not necessarily the Builder’s drop-time styles or size. Appearance fields belong to Builder Appearance. C# events are not all forwarded to JavaScript.

PropertyC# typeConstructor defaultWritable
NarrowColumnsInt321Yes
BreakpointInt32600Yes
OrientationString"horizontal"Yes
GapInt328Yes
ColumnsInt322Yes
TabsString[]["Tab 1","Tab 2"]Yes
RowCountInt322Yes
SelectedTabInt320Yes
NameStringnullYes
LayoutSlotInt321Yes
XNullable1`nullYes
YNullable1`nullYes
TextStringnullYes
ValueStringnullYes
PlaceholderStringnullYes
LabelStringnullYes
ControlTypeString"responsivegrid"No

Core methods: GetRenderState(), HandleRuntimeEvent(runtimeEvent), Add(child), Insert(index, child), MoveChild(child, index), Remove(child).

Core events: ChildAdded, ChildRemoved, PropertyChanged.

Additional behavior notes

An ordered CSS grid with a separate column count below its own width breakpoint. Inherits ResponsiveLayout/LinearLayout. Columns defaults to 2 (1–12), NarrowColumns to 1 (1–12), Breakpoint to 600 (100–2400), and Gap to 8 (0–64). Inspector and JS get/set/bind use columns, narrowColumns, breakpoint, and gap. At the exact breakpoint the wide column count applies. Design mode shows column guides; Preview shows only the application content. Child order determines cells, dragging reorders, and grid tracks own child width. Height remains adjustable. Margins and explicit size constraints remain applicable; oversized minimum widths can cause overflow. Grid cells are not TableLayoutPanel layoutSlot cells.

Search components, properties, and guides.

↑↓ navigate Enter open Esc close