Orchard Core Admin Lists
Every Orchard Core 4.0 admin page that lists items (content items, users, features, queries, workflows, layers, ...) renders them through the shared AdminList shape from OrchardCore.Admin. The shape renders the search bar, page actions, toolbar (item count, select-all, bulk actions), rows, empty message, pager, and page size selector in the layout the site (or the user) picks. Never hand-write a <ul class="list-group">, <table>, toolbar, or pager for an admin listing.
Layouts
| Enum | Values | Description |
|---|---|---|
| AdminListLayout | List (default), Grid | List renders each item's SummaryAdmin shape as a whole row. Grid renders the item's SummaryAdminGrid shape, one cell per declared AdminListColumn, on a CSS grid whose header always lines up; below 48rem of list width (container query) it stacks like a List row instead of scrolling. |
| AdminListActionsLayout | Buttons (default), Menu | Buttons renders the Actions zone as buttons plus an "Actions" dropdown for ActionsMenu. Menu renders everything in one ellipsis dropdown (a btn-sm btn-outline-secondary toggle, not wrapped in a btn-group). |
Exactly these values exist; templates can restyle them but cannot register more layouts.
Ownership
| Layer | Responsibility |
|---|---|
| Controller | Query raw items and assign an AdminListContext<TModel> with Source, Pager, and optional region shapes. Never build the list or row shapes. |
| View | Render <admin-list name="..." context="Model.List"> and declare the grid columns and presentation. |
| Row display driver | A DisplayDriver<TModel> returning shapes with a SummaryAdmin location (List) and a SummaryAdminGrid location (Grid). |
| Column provider | Optional IAdminListColumnsProvider adding or changing another list's columns. |
| AdminList shape | Resolves the layout at display time, builds each row once with that layout's display type, and renders the whole listing. |
Do not add column or cell drivers, column metadata classes, or build both representations of a row.
When to Use
| Situation | Do this |
|---|---|
| New admin page that lists items | Follow "Building a List Page" below. |
| Controller already builds rows with BuildDisplayAsync(item, updater, "SummaryAdmin") and the view loops over them | Move the raw items into AdminListContext<TModel>.Source, delete the row building, add SummaryAdminGrid locations to the driver, render <admin-list>. |
| Rows are hard-coded <li> markup in Razor | Write a DisplayDriver<TModel> for the row model first, so each row is a zone-holding shape, then build the page. |
| Adding a column to another module's list | Column provider plus a SummaryAdminGrid location in your driver (see "Extending Another Module's Columns"). |
| The page edits one entity | Not a list; see orchardcore-admin-edit-views. |
| The page arranges items rather than listing them (a tree, a canvas, a media library, widgets by zone) | Keep its own presentation. |
Building a List Page
1. Controller
model.List = new AdminListContext<Announcement>
{
Source = announcements,
Pager = pagerShape,
};
The view model exposes public AdminListContext List { get; set; }. The generic argument selects the display model type (also for empty collections, and for a base class or interface display manager). Rows are built only while the view renders, after the layout is resolved, so driver queries and errors happen at render time.
2. View
Import the tag helpers once (for example in Views/_ViewImports.cshtml):
@using OrchardCore.Admin
@addTagHelper *, OrchardCore.Admin.Abstractions
The view keeps the form, its hidden inputs, and the action bar, and renders the list inside the form:
<form asp-action="Index" method="post" class="no-multisubmit" data-list-management data-selected-label="@T["selected"]">
@* Keep the hidden filter submit first: Enter in the search box triggers it. *@
<input type="submit" name="submit.Filter" id="submitFilter" class="visually-hidden" />
<input asp-for="Options.BulkAction" type="hidden" />
<input type="submit" name="submit.BulkAction" class="visually-hidden" />
@* Search input group and page buttons in a sticky action bar, see references/admin-lists-examples.md *@
<admin-list name="Announcements" context="Model.List"
bulk-actions="Model.Options.BulkActions"
empty-message="@T["<strong>Nothing here!</strong> There are no announcements yet."]">
<admin-list-list item-css-class="list-group-item" />
<admin-list-grid>
<admin-list-column type="Select" />
<admin-list-column name="Title" title="@T["Title"]" position="20" />
<admin-list-column name="Status" title="@T["Status"]" position="30" width="auto" no-wrap="true" />
<admin-list-column type="Actions" title="@T["Actions"]" />
</admin-list-grid>
</admin-list>
</form>
<script asp-name="list-management" at="Foot"></script>
nameidentifies the list for column providers, the user's layout choice, and alternates. Use a string literal when only the view uses it; keep a module constant (likeContentsAdminList.Name) only when code reuses it.- The search is an input group ending with a magnifying-glass submit button (
name="submit.Filter" value="submit.Filter"), never an icon inside the input. TheAdminListSearchshape renders exactly that. The button needs avalue:[FormValueRequired("submit.Filter")]rejects an empty value, so a valueless button reloads the list unfiltered (only Enter, through the hidden input, filtered before the fix). - Filters rendered with
bootstrap-selectinside.admin-list(or withdata-selected-text-format="static") keep their button color while nothing is selected, so every filter of a list looks alike. - The
list-managementscript resource (fromOrchardCore.Resources) wires every[data-list-management]root: the toolbar's#select-all,#items,#selected-items, and#actionselements,itemIdsrow checkboxes, bulk action.dropdown-item[data-action]links (confirmed through TheAdmin'sconfirmDialogwhen they carrydata-message, as the generated toolbar's do), the hiddenOptions.BulkActioninput, andsubmit.BulkAction. Override names withdata-item-input-name,data-bulk-action-input-name,data-submit-bulk-action-name, anddata-min-selected-items; adddata-client-side-search="true"to filter rows by theirdata-filter-valueattribute as the user types in#search-box, with an optional#list-alertelement shown when nothing matches. - Keep those ids as the toolbar renders them; scripts and alternates rely on them.
3. Row Display Driver
Pair every location with a display type. The shape type and template are shared; only the zone differs:
public sealed class AnnouncementDisplayDriver : DisplayDriver<Announcement>
{
public override Task<IDisplayResult> DisplayAsync(Announcement announcement, BuildDisplayContext context)
{
// Row classes and attributes render on the row element in both layouts.
if (context.DisplayType is OrchardCoreConstants.DisplayType.SummaryAdmin or OrchardCoreConstants.DisplayType.SummaryAdminGrid
&& context.Shape is Shape row)
{
row.Attributes["data-filter-value"] = announcement.Title?.ToLowerInvariant() ?? string.Empty;
}
return CombineAsync(
View("Announcement_Checkbox_SummaryAdmin", announcement)
.Location(OrchardCoreConstants.DisplayType.SummaryAdmin, "Checkbox:1")
.Location(OrchardCoreConstants.DisplayType.SummaryAdminGrid, "Select:1"),
View("Announcement_Fields_SummaryAdmin", announcement)
.Location(OrchardCoreConstants.DisplayType.SummaryAdmin, "Content:1")
.Location(OrchardCoreConstants.DisplayType.SummaryAdminGrid, "Title:1"),
View("Announcement_Status_SummaryAdmin", announcement)
.Location(OrchardCoreConstants.DisplayType.SummaryAdmin, "Tags:5")
.Location(OrchardCoreConstants.DisplayType.SummaryAdminGrid, "Status:5"),
View("Announcement_Buttons_SummaryAdmin", announcement)
.Location(OrchardCoreConstants.DisplayType.SummaryAdmin, "Actions:5")
.Location(OrchardCoreConstants.DisplayType.SummaryAdminGrid, "Actions:5"));
}
}
Register it with services.AddDisplayDriver<Announcement, AnnouncementDisplayDriver>() in the feature that owns the list; a driver registered by a neighbouring feature leaves every row empty on sites where that feature is off. The row shape type is typeof(TModel).Name plus the display type (Announcement_SummaryAdmin), so drive a domain model or a dedicated entry record named what the shape should be called, not a *ViewModel.
- Every visible piece of a row (checkbox, title, badges, dates, buttons, menu items) is its own shape in a zone. Anything hard-coded in the row template is missing from the grid.
- A location without a display type applies to both, so
.Location("Tags:5")lands in aTagszone no column renders. Pair everySummaryAdminlocation with aSummaryAdminGridone, unless the zone name is also a column name (such asActions). - A grid-only shape declares only a
SummaryAdminGridlocation. Display types do not inherit placement, whether it comes from a driver orplacement.json. - Never use editor
|Columngroupings for cells; columns come from<admin-list-column>.
The full controller, views, and templates are in references/admin-lists-examples.md.
Tag Helper Reference
<admin-list> requires name and context:
| Attribute | Purpose |
|---|---|
| name | Stable list identity used by column providers, the user's layout cookie, and alternates. Not part of the context. |
| context | The AdminListContext from the view model. |
| bulk-actions | IList<SelectListItem> for the generic toolbar; each Value is the posted action name. |
| empty-message | IHtmlContent shown when there are no rows (defaults to "No results found."). |
| show-toolbar, show-select-all, show-layout-selector | Override the matching context flags. |
| layout | Forces List or Grid. |
| item-css-class | Row classes for the List layout (default list-group-item list-group-item-action). |
| rows-* / rows-attributes | Attributes on the element wrapping the rows, e.g. rows-id="my-sortable-list". |
<admin-list-list> and <admin-list-grid> accept rows-class and item-css-class, may each be declared once, configure their layout without forcing it, and emit no HTML. For Grid, item-css-class adds to the required grid row class.
<admin-list-column> (inside admin-list or admin-list-grid):
| Attribute | Purpose |
|---|---|
| type | Select (the Select zone at position 10) or Actions (Actions and ActionsMenu zones at position end, end-aligned). Omit for a regular column. |
| name | Required for regular columns, unique ignoring case. Default zone and admin-list-column-{name} CSS class. |
| title | Localized header text; also labels stacked cells. |
| position | Placement syntax (10, 25, 35.5, end). Columns sort after all providers ran; unpositioned columns go last. |
| width | Any CSS width (20%, 12rem) or auto to hug the content. Columns without a width share the remaining space, down to 8rem each (minmax(8rem, 1fr)), so titles do not break mid-word. |
| alignment | Start (default), Center, End. |
| no-wrap | Prevents wrapping, e.g. dates and badges. |
| css-class | Extra classes on the header and cells. |
| zones | Comma- or space-separated row zones to render instead of the zone named after the column. |
`AdminListContext` Properties
| Property | Description |
|---|---|
| Source, ItemType | Raw items; AdminListContext<TModel> sets ItemType and types Source. |
| Pager, PageSize | Pager shape; a separately placed page size selector (set ShowPageSizeSelector = false on the pager to avoid rendering it twice). |
| Header | Options editor shape whose Summary and Actions zones render above the rows (content items, users). |
| Toolbar, ShowToolbar, ShowSelectAll, BulkActions, ToolbarActions | Supply a custom toolbar, or let the list build AdminListToolbar from the rows, pager, and bulk actions. |
| Search, Actions | Search-bar shape (e.g. AdminListSearch with Name, Value, Placeholder, Id, SubmitName, Autofocus, and a Filters zone) and the page buttons the layout places at the top of the list, for example Actions = await _shapeFactory.CreateAsync("LayersCreateButton") rendering a btn btn-secondary create Add Layer link. |
| Layout, ShowLayoutSelector | Force a layout (e.g. while rows are drag-sorted) and hide the selector. |
| Data | Values for column providers, e.g. ContentsAdminList.ContentTypesKey. |
| RowsAttributes, ItemCssClass, ListOptions, GridOptions, EmptyMessage | Presentation. |
The default IAdminListItemDisplayManager<TModel> delegates to IDisplayManager<TModel>; register a closed implementation for a specialized pipeline (Contents uses one that calls IContentItemDisplayManager).
Row Templates and Placement
{Model}.SummaryAdmin.cshtml renders the zones for the List layout only (the grid renders column zones directly). Every shipped row uses the same structure so lists look alike:
<div class="row g-0 align-items-center">
<div class="col">
<div class="title d-flex align-items-center">
@* Checkbox zone, then <div class="summary d-flex flex-column flex-md-row list-item-search-text"> with Content, Tags, Meta *@
</div>
@if (Model.Description != null)
{
@await DisplayAsync(Model.Description)
}
</div>
<div class="col-auto d-flex justify-content-end ps-2">
@await DisplayAsync(await Factory.CreateAdminListActionsAsync((IShape)Model))
</div>
</div>
| Zone | Renders as | Never |
|---|---|---|
| Content | The title, a plain link to the edit page | A heading (<h5>) |
| Tags, Meta | One <span class="badge ta-badge fw-normal"> per fact, with a leading icon and a title tooltip (the users list puts the email badge and UserRolesMeta role badges here) | Plain text or <span class="hint"> |
| Description | <div class="admin-list-secondary">, its own line under the title | A full-width row running under the actions |
| Actions, ActionsMenu | Through CreateAdminListActionsAsync, so the Buttons/Menu setting applies; menu items are bare <a>/<button class="dropdown-item"> | A hand-written button group, or menu items wrapped in <li> |
| Checkbox | A form-check whose label holds <span class="visually-hidden">@T["Select {0}", name]</span>, so screen readers name the checkbox | An empty label |
placement.jsonrules filtered by"displayType": "SummaryAdminGrid"move a shape to another column zone, hide it ("place": "-"), change its template, or add wrappers and alternates, independently of the List layout:
{
"ContentCulture_SummaryAdmin": [
{ "displayType": "SummaryAdminGrid", "place": "Status:10" }
]
}
- Whole-row templates such as
Content-BlogPost.SummaryAdmin.cshtmlaffect onlyList; customize grid cells withAdminListCell-{ListName}-{Column}.cshtml, which receivesRowandColumn. The grid only createsAdminListCellshapes for overridden cells (seeCellRenderings). - Rows that are not list rows can still follow the actions layout:
Widget.SummaryAdmin(Design → Widgets zones),MenuItem.Admin(menu editor) andContent.TermAdmin(taxonomy editor) add their Edit/Add/Delete buttons to theActionszone and render@await DisplayAsync(await Factory.CreateAdminListActionsAsync((IShape)Model)). A template can add markup to its own zone withawait ((IShape)((IZoneHolding)Model).Zones["Actions"]).AddAsync(html). - The users row reads like a content row: the user name is a title link (not a heading), the email an outlined badge, and
UserRolesMetais placed inMetaforSummaryAdmin(it wasDescription) and inRolesforSummaryAdminGrid.UserDisplayName.SummaryAdminGridrenders a user (such as a content item's author) as the same badge in the Grid layout. - The content items row now places the title link and type badge as
ContentsTitle_SummaryAdminandContentsType_SummaryAdminin theTitleandTypezones. - The Actions cell renders the row's
ActionsandActionsMenuzones throughAdminListActions; moving an action shape to another zone removes it from that cell. - On the shape,
Rowsis output built during display (never an input) andDisplayTypeis the resolved row display type. Rows and regions inherit the list name and layout, so their alternates work without the page passing them.
Extending Another Module's Columns
public sealed class CultureColumnsProvider : IAdminListColumnsProvider
{
private readonly IStringLocalizer S;
public CultureColumnsProvider(IStringLocalizer<CultureColumnsProvider> localizer)
{
S = localizer;
}
public Task PopulateAsync(AdminListColumnsContext context)
{
context.Columns.Add(new AdminListColumn
{
Name = "Culture",
Position = "25",
Title = S["Culture"],
Width = AdminListColumn.AutoWidth,
});
return Task.CompletedTask;
}
}
services.AddAdminListColumnsProvider<CultureColumnsProvider>(ContentsAdminList.Name);
services.AddAdminListColumnsProvider<SiteColumnsProvider>(); // global, every list
- Named providers are keyed scoped services (
AdminListColumnsProviderKey); list names are case-sensitive and only matching providers are constructed. Duplicate registrations are ignored. - Global providers run first, then named ones, each group in feature dependency order; columns are sorted afterwards. Duplicate column names throw; provider errors are logged.
context.ListName,context.Find(name),context.Remove(name),context.Data,TryGetData<T>(), andGetData<T>()are available. Global providers must checkFindbefore changing optional columns.- A provider never renders cells: a display driver must place a shape in that column's zone for
SummaryAdminGrid. AdminListColumns.Select()andAdminListColumns.Actions(S["Actions"])create the shared first and last columns in C#.
Published list names include ContentsAdminList.Name (Contents) and UsersAdminList.Name (Users); others are literal, e.g. Features, Queries, Layers, Tenants, WorkflowTypes, AdminMenus, AuditTrail, Roles, Templates. The Contents list passes ContentsAdminList.ContentTypesKey and ContentsAdminList.StereotypesKey in Data.
Configuration and Settings
Shipped defaults come from AdminListOptions, bound per tenant from OrchardCore:Admin:List:
{
"OrchardCore": {
"Admin": {
"List": {
"DefaultLayout": "Grid",
"DefaultActionsLayout": "Menu",
"AllowUserSelection": true
}
}
}
}
Settings → Admin overrides them with List layout, Actions layout (each with Use configuration default; the actions layout also drives the edit page action bar, see orchardcore-admin-edit-views), and Let users choose the layout of a list, stored on AdminSettings:
{
"steps": [
{
"name": "settings",
"AdminSettings": {
"ListLayout": "Grid",
"ActionsLayout": "Menu",
"AllowUserListLayoutSelection": true
}
}
]
}
AdminListOptions participates in the signal-backed refresh pipeline: read it through IOptionsMonitor<AdminListOptions>.CurrentValue; saving the settings applies without a shell release.
Let users choose the layout of a list is on by default (AdminSettings.AllowUserListLayoutSelection = true); the site setting is copied over AdminListOptions.AllowUserSelection, so turn it off in Settings → Admin to make every list use the site layout. With user selection on, each list shows a List/Grid selector; a click reloads with ?layout=Grid and stores the choice in a per-list cookie. Resolution order is AdminListContext.Layout, then ?layout=, then the cookie, then the site setting, then AdminListOptions.DefaultLayout. Invalid values are ignored. A list without columns falls back to List and shows no selector. A page rendering several lists (grouped by category) sets ShowLayoutSelector = false on each and creates one selector shape:
model.LayoutSelector = await shapeFactory.CreateAsync(AdminListConstants.LayoutSelectorShapeType, Arguments.From(new
{
ListName = "Features",
}));
Alternates
| Shape | Alternates (least to most specific) |
|---|---|
| AdminList | AdminList__{Layout}, AdminList__{Name}, AdminList__{Name}__{Layout} |
| AdminListCell | AdminListCell__{Column}, AdminListCell__{Name}__{Column} |
| AdminListActions | AdminListActions__{Layout}, AdminListActions__{Name}, AdminListActions__{Name}__{Layout} (layout is Buttons or Menu) |
| AdminListToolbar | AdminListToolbar__{Layout}, AdminListToolbar__{Name}, AdminListToolbar__{Name}__{Layout} |
| AdminListSearch | AdminListSearch__{Layout}, AdminListSearch__{Name}, AdminListSearch__{Name}__{Layout} |
Examples are AdminList-Contents-Grid.cshtml and AdminListActions-Menu.cshtml. A name-only alternate such as AdminList-Users.cshtml applies to every layout of that list (opting it out of the setting); name the layout to change one mode. The list stamps ListName and ListLayout on its toolbar, search, pager, page size selector, and rows, so alternates resolve without the page passing them.
Sortable Lists
Mark the rows container with rows-* attributes (e.g. rows-id="rewrite-rules-sortable-list") and drag the rows, not their container: in Grid the container is display: contents. Use SortableJS oldDraggableIndex/newDraggableIndex, which count only rows. Force Layout = AdminListLayout.List only when the page cannot render a grid while sorting.
Gotchas
- Never name a view model's rows
Items:Shapealready exposesItems(its child shapes). - An empty grid column means a shape has no
SummaryAdminGridlocation for that column's zone. - Per-type row templates only affect
List: change the grid withSummaryAdminGridplacement orAdminListCell-{List}-{Column}.cshtml. - Never wrap
ActionsMenuitems in<li>: the dropdown sits inside the row's<li>in the List layout, the HTML parser hoists the nested<li>out, and the menu renders empty with stray links under the list. - No viewport classes such as
d-md-nonein row Razor: the grid stacks through a container query on the list itself, because the admin sidebar makes the viewport a poor proxy for the list width. - Rows are built while the view renders, from the
AdminListdisplaying event, so driver queries and exceptions surface at render time, not in the controller.
Checking a List
Check every list page in both layouts and both actions layouts (Buttons and Menu), with rows and with none (empty message), and in a narrow window where the grid stacks its cells. In the Grid layout every declared column should render something on every row. Keep Let users choose the layout of a list on (the default) while developing to switch quickly.
Upgrading from 3.x
- Overriding a module's list view (e.g.
Views/Admin/Index.cshtml) is a breaking change: an override that writes its own<ul class="list-group">keeps the old look and ignores the selected layout. Render the view model'sListcontext with<admin-list>and declare columns with<admin-list-column>. - Before, controllers built row shapes (
BuildDisplayAsync(item, updater, "SummaryAdmin")) and views looped over them. Now controllers assign raw records toAdminListContext<TModel>.Sourceand the list builds rows. - Built-in listing collections (
ListContentsViewModel.ContentItems,Users,Queries, ...) now hold raw records, not row shapes or model/shape pairs; custom templates reading them must adapt.ContentsAdminList.cshtmlrenders throughListContentsViewModel.List. - Add
SummaryAdminGridlocations to existing row drivers, or their content is missing from the grid. AdminSettings.ListActionsLayout(4.0 previews) is nowAdminSettings.ActionsLayout, labelled Actions layout, and also controls the edit page action bar. Update recipes and tests; the old stored value is not migrated.- Audit trail rows now have
Event,Category,Details, andActionscolumns;AuditTrailEventTags_SummaryAdminwas replaced byAuditTrailEventName_SummaryAdmin(EventNamezone) andAuditTrailEventCategory_SummaryAdmin(EventCategoryzone).
Related Skills
orchardcore-adminfor admin controllers, routes, and settings pages.orchardcore-admin-edit-viewsfor the create and edit pages a list links to.orchardcore-breadcrumbsfor the page title trail; reuse the list name as the trail name.orchardcore-navigationfor pager shapes and page size selection.orchardcore-contents-admin-list-filtersandorchardcore-users-admin-list-filtersfor list filters.