Property Grid

Description

PropertyGrid<T> reflects over a typed object's public properties at render time and generates a two-way-bound editing form without any markup. Each property is mapped to an input control based on its declared type:

Property type Control
string TextBox (single-line) or TextArea (when [PropertyGridMultiline] or .Multiline(...) is set)
bool Toggle
enum Single-select Dropdown populated from Enum.GetValues
int, long, short, byte, and unsigned variants NumberPicker
double, float, decimal Numeric TextBox (type="number" step="any")
DateTime / DateTime? DateTimePicker
Color ColorPicker
Nested class or struct Recursive Expander section containing another PropertyGrid pass
Anything else Read-only TextBox showing .ToString()

Edits write directly back to the bound object and notify subscribers via AsObservable() or OnChange(...). Read-only mode (ReadOnly() with no arguments) renders the whole grid non-editable; passing property names restricts read-only to those specific fields. Per-property behaviour (label, description, order, read-only, multiline, validation) is set through [PropertyGrid*] attributes on the class, the fluent config API on the PropertyGrid<T> instance, or both — attributes are applied first and the fluent config wins when both are present.

Properties without a setter are automatically treated as read-only. Properties marked [PropertyGridIgnore] are skipped entirely. Display order defaults to declaration order; it can be overridden with [PropertyGridOrder(n)] or .Order(name, n) (lower values appear first).

Use PropertyGrid<T> when you need a generic editor for a settings object, a form that tracks a typed model, or a debug inspector for any class instance — without writing per-property form code.

Factory method: UI.PropertyGrid<T>(instance) or the non-generic UI.PropertyGrid(instance) (returns PropertyGrid<object>).

API reference

class

PropertyGridLabelAttribute

public sealed class PropertyGridLabelAttribute : Attribute

Marks a property with a friendly label for the PropertyGrid{T}. Attribute support is best-effort (it depends on reflection metadata being available); the fluent config API is always honored.

Namespace
Tesserae
Inheritance
Attribute → PropertyGridLabelAttribute

Constructors

NameDescription
PropertyGridLabelAttributeInitializes a new instance of the PropertyGridLabelAttribute class.
Constructor
PropertyGridLabelAttribute
public PropertyGridLabelAttribute(string label)

Initializes a new instance of the PropertyGridLabelAttribute class.

Properties

NameDescription
LabelThe display label.
Property
PropertyGridLabelAttribute.Label
public string Label { get; }

The display label.

class

PropertyGridDescriptionAttribute

public sealed class PropertyGridDescriptionAttribute : Attribute

Marks a property with a helper description for the PropertyGrid{T}.

Namespace
Tesserae
Inheritance
Attribute → PropertyGridDescriptionAttribute

Constructors

NameDescription
PropertyGridDescriptionAttributeInitializes a new instance of the PropertyGridDescriptionAttribute class.
Constructor
PropertyGridDescriptionAttribute
public PropertyGridDescriptionAttribute(string description)

Initializes a new instance of the PropertyGridDescriptionAttribute class.

Properties

NameDescription
DescriptionThe description text.
Property
PropertyGridDescriptionAttribute.Description
public string Description { get; }

The description text.

class

PropertyGridOrderAttribute

public sealed class PropertyGridOrderAttribute : Attribute

Sets the display order of a property in the PropertyGrid{T} (lower comes first).

Namespace
Tesserae
Inheritance
Attribute → PropertyGridOrderAttribute

Constructors

NameDescription
PropertyGridOrderAttributeInitializes a new instance of the PropertyGridOrderAttribute class.
Constructor
PropertyGridOrderAttribute
public PropertyGridOrderAttribute(int order)

Initializes a new instance of the PropertyGridOrderAttribute class.

Properties

NameDescription
OrderThe sort order.
Property
PropertyGridOrderAttribute.Order
public int Order { get; }

The sort order.

class

PropertyGridReadOnlyAttribute

public sealed class PropertyGridReadOnlyAttribute : Attribute

Marks a property as read-only in the PropertyGrid{T}.

Namespace
Tesserae
Inheritance
Attribute → PropertyGridReadOnlyAttribute
class

PropertyGridIgnoreAttribute

public sealed class PropertyGridIgnoreAttribute : Attribute

Hides a property from the PropertyGrid{T}.

Namespace
Tesserae
Inheritance
Attribute → PropertyGridIgnoreAttribute
class

PropertyGridMultilineAttribute

public sealed class PropertyGridMultilineAttribute : Attribute

Renders a string property as a multi-line TextArea in the PropertyGrid{T}.

Namespace
Tesserae
Inheritance
Attribute → PropertyGridMultilineAttribute
class

PropertyGridFieldOptions

public sealed class PropertyGridFieldOptions

Per-property display / behaviour options resolved from attributes and the fluent config API.

Namespace
Tesserae

Fields

NameDescription
LabelOverrides the field label.
DescriptionA helper description shown beneath the editor.
OrderExplicit display order (lower comes first).
ReadOnlyWhether the field is read-only.
IgnoreWhether the field is hidden.
MultilineWhether a string field is rendered multi-line.
ValidateA validation function returning an error message (or null/empty when valid) for the current value.
Field
PropertyGridFieldOptions.Label
public string Label

Overrides the field label.

Field
PropertyGridFieldOptions.Description
public string Description

A helper description shown beneath the editor.

Field
PropertyGridFieldOptions.Order
public int? Order

Explicit display order (lower comes first).

Field
PropertyGridFieldOptions.ReadOnly
public bool ReadOnly

Whether the field is read-only.

Field
PropertyGridFieldOptions.Ignore
public bool Ignore

Whether the field is hidden.

Field
PropertyGridFieldOptions.Multiline
public bool Multiline

Whether a string field is rendered multi-line.

Field
PropertyGridFieldOptions.Validate
public Func<object, string> Validate

A validation function returning an error message (or null/empty when valid) for the current value.

class

PropertyGrid<T>

public sealed class PropertyGrid<T> : IComponent

A metadata-driven property editor. Given a typed object it reflects over its public properties and auto-generates a two-way-bound editing form, mapping each property type to an existing Tesserae input (string → TextBox/TextArea, numbers → NumberPicker, bool → Toggle, enum → Dropdown, DateTime → DateTimePicker, Color → ColorPicker, nested objects → a recursive grouped Expander section). Edits flow straight back onto the bound object and are surfaced via AsObservable / OnChange. Per-property label/description/order/read-only overrides come from attributes or the fluent config API, and validation integrates with the existing Validator.

Namespace
Tesserae
Implements
IComponent

Constructors

NameDescription
PropertyGridInitializes a new instance of the PropertyGrid{T} class bound to instance.
Constructor
PropertyGrid
public PropertyGrid(T instance)

Initializes a new instance of the PropertyGrid{T} class bound to instance.

Methods

NameDescription
AsObservableReturns an observable that fires (with the bound instance) whenever any field is edited.
OnChangeRegisters a callback invoked (with the bound instance) whenever any field is edited.
WithValidatorWires the grid's validatable editors to the supplied Validator.
LabelOverrides the label shown for a property.
DescriptionSets a helper description shown beneath a property's editor.
OrderSets the display order of a property (lower comes first).
ReadOnlyMarks fields as read-only. When restrictTo is null or empty the whole grid becomes a read-only view (every field shows its value but cannot be edited); otherwise only the named properties are made read-only. Read-only fields do not flow edits back to the bound object.
IgnoreHides one or more properties.
MultilineRenders a string property as a multi-line text area.
ValidateAdds a validation rule for a property. The function receives the property's current value and returns an error message (or null/empty when valid). Integrates with the configured Validator.
RenderRenders the component's root HTML element.
Method
PropertyGrid.AsObservable
public IObservable<T> AsObservable()

Returns an observable that fires (with the bound instance) whenever any field is edited.

Method
PropertyGrid.OnChange
public PropertyGrid<T> OnChange(Action<T> onChange)

Registers a callback invoked (with the bound instance) whenever any field is edited.

Method
PropertyGrid.WithValidator
public PropertyGrid<T> WithValidator(Validator validator)

Wires the grid's validatable editors to the supplied Validator.

Method
PropertyGrid.Label
public PropertyGrid<T> Label(string propertyName, string label)

Overrides the label shown for a property.

Method
PropertyGrid.Description
public PropertyGrid<T> Description(string propertyName, string description)

Sets a helper description shown beneath a property's editor.

Method
PropertyGrid.Order
public PropertyGrid<T> Order(string propertyName, int order)

Sets the display order of a property (lower comes first).

Method
PropertyGrid.ReadOnly
public PropertyGrid<T> ReadOnly(params string[] restrictTo)

Marks fields as read-only. When restrictTo is null or empty the whole grid becomes a read-only view (every field shows its value but cannot be edited); otherwise only the named properties are made read-only. Read-only fields do not flow edits back to the bound object.

Method
PropertyGrid.Ignore
public PropertyGrid<T> Ignore(params string[] propertyNames)

Hides one or more properties.

Method
PropertyGrid.Multiline
public PropertyGrid<T> Multiline(string propertyName)

Renders a string property as a multi-line text area.

Method
PropertyGrid.Validate
public PropertyGrid<T> Validate(string propertyName, Func<object, string> validate)

Adds a validation rule for a property. The function receives the property's current value and returns an error message (or null/empty when valid). Integrates with the configured Validator.

Method
PropertyGrid.Render
public HTMLElement Render()

Renders the component's root HTML element.

See also

© 2026 Curiosity. All rights reserved.