Attributes for Automatic UI Generation with CRUD Pages

When using CRUD Pages in Bloqs, you can decorate your entity classes with attributes that control how the fields are displayed and behave in the automatically generated UI. These attributes help define visibility, editability, labels, relations, and conditional rendering without having to manually code the UI.

Attribute Overview

Attribute
Purpose

[ExcludeFromDefaultUI]

Excludes the field from the UI.

[Readonly]

Shows the field but makes it non-editable.

[Relation]

Marks the field as a relation to another entity (relations are stored as a Guid).

[Title]

Defines a custom label for the field in the UI.

[VisibleLogic]

Dynamically controls whether a field is visible, based on conditions.

[DisableInlineEditing]

Disable inline editing for the decorated property. Only supported on List properties.

[HelpInfo]

Specify a help info text for a certain property or enum value.

[IncludeInDefaultView]

Use this property in default views, such as lists and overviews.

[Order]

Defines the order of a property in the UI.

[Paper]

Display this property inside a paper-styled container.

[SpaceDemand]

The amount of space (1–12) this property should occupy in the layout.

[StringType]

Specify what kind of string is used, like SingleLine or MultiLine.


Examples

ExcludeFromDefaultUI

[ExcludeFromDefaultUI]
public string InternalCode { get; set; }

Readonly

[Readonly]
public bool Closed { get; set; }

Relation + Title

[Title("User")]
[Relation(typeof(UserAccount))]
public Guid UserAccountId { get; set; }

Title

[Title("Activity Name")]
public string Name { get; set; }

VisibleLogic

[VisibleLogic("IsActivityPrioVisible")]
public int? Prio { get; set; }

Combining Attributes

You can also combine multiple attributes on a single property to fine-tune its behavior in the UI.

Example: a read-only relation with a custom label:

[Title("Owner")]
[Relation(typeof(UserAccount))]
[Readonly]
public Guid OwnerId { get; set; }

This ensures the Owner field is shown with a friendly title, linked to a UserAccount, but cannot be edited by the user.

Last updated