Columns
Choose the columns the index grid displays
StellarAdmin does not automatically add any columns for the index page grid. You must add columns by calling the Add() of the resource column builder. The example below adds four columns to the bookings grid, including additional configuration for the booking date and special requests columns via their respective column builders.
resource.Index(index => index.Columns(columns =>
{
columns.Add(booking => booking.Reference);
columns.Add(booking => booking.BookedAt, column =>
{
column.Title = "Booked";
column.Sortable();
});
columns.Add(booking => booking.TotalAmount);
columns.Add(booking => booking.SpecialRequests, column => column.EmptyText = "No requests");
}));

As you've seen in the code sample above, you can pass additional configuration for a column via its column builder. The following properties and methods are available on the column builder.
| Setting | Description |
|---|---|
Title | Sets the column's header. The default is the property's [Display(Name)], or else the property name split into words, such as "Departure Date". |
EmptyText | Sets the text to display when the value is null or empty. The default is the property's [DisplayFormat(NullDisplayText)], or else an empty cell. |
Sortable() | Allows users to sort the grid by the column. |
UseDisplay<TDisplay>() | Renders the value of the column with a different display type. |
UseBuiltInRendering() | Renders the value as text, formatted with the property's [DisplayFormat], instead of with a display. This is useful when you want to opt out of the column's default display type and simply want to display the column value as plain text. |
Choosing how values are rendered
Unless specified otherwise, a column renders its value with a display type that StellarAdmin chooses from the property's type. For example, numbers are right-aligned, dates are rendered like "3 Nov 2026", a bool is rendered as an icon, and an enum is rendered with its [Display(Name)].
To render a value differently, call UseDisplay() with the display type to use. The example below renders the total as a currency:
using StellarAdmin.Resources.Displays;
columns.Add(booking => booking.TotalAmount, column =>
column.UseDisplay<NumberDisplay>(number => number.Format = "C"));

See displays for every display type and its settings.
Displaying related records
You can reference related resources in columns. For EF Core, StellarAdmin will automatically detect the navigation property and include the referenced entity when loading the data.
columns.Add(booking => booking.Traveller);
columns.Add(booking => booking.Traveller.Email, column => column.Title = "Traveller email");For the Traveler property, StellarAdmin will see it is a related resource and use the title of that resource as the display value.


See displaying related records for more information on how StellarAdmin display related records.
Displaying computed values
A column can display any expression, not only a property. The example below displays the travel dates as a date range.
columns.Add(
booking => $"{booking.Departure.StartDate:d MMM} – {booking.Departure.EndDate:d MMM yyyy}",
column =>
{
column.Title = "Travel dates";
column.Sortable(booking => booking.Departure.StartDate);
});A computed column must specify a Title, because there's no property from which to resolve the title. If the column is sortable, you must also pass a sort expression to Sortable(), since StellarAdmin cannot sort by computed values.
Writing your own cell markup
If you have special requirements for rendering the display value, which is not covered by any of the built-in display types, you can create a custom display.