Installation

Get started with StellarAdmin.UI

Add to existing project

The following installation instructions assume you are adding StellarAdmin to an existing ASP.NET Core MVC or Razor Pages project.

Install package

Install the StellarAdmin.UI NuGet package.

dotnet add package StellarAdmin.UI

Register services

Update your Program.cs (or Startup.cs) to register the StellarAdmin services.

using StellarAdmin.UI;

builder.Services.AddStellarAdminUI();

AddStellarAdminUI() also changes the MVC options for the whole app: it adds a model binder and a value provider that bind checkbox groups, and a global result filter that sends queued toasts in a response header for fetch and XHR requests.

Update imports

Update your _ViewImports.cshtml to register the StellarAdmin Tag Helpers and import the StellarAdmin.UI namespace.

@using StellarAdmin.UI
@addTagHelper *, StellarAdmin.UI

Add stylesheet and JavaScript file

Add the StellarAdmin stylesheet and the StellarAdmin JavaScript file to your Razor page. The stylesheet carries every component and the default theme.

<!DOCTYPE html>
<html lang="en">
<head>
    ...
    <link rel="stylesheet" href="/_content/StellarAdmin.UI/stellar-admin.css" asp-append-version="true"/>
    <script defer src="/_content/StellarAdmin.UI/stellar-admin.js" asp-append-version="true"></script>
</head>
<body>
    ...
</body>
</html>

To change the default theme, create a theme file in the theme builder and link it after the stylesheet. The Theming page provides more information on theming.

Start using the Tag Helpers

Start using the StellarAdmin Tag Helpers inside your Razor Pages or MVC Views. For example, the code snippet below adds an alert to your page.

<sa-alert>
    <sa-alert-title>Success! You have configured StellarAdmin correctly.</sa-alert-title>
</sa-alert>

Before you start using the components, read the Conventions page. It covers the rules every Tag Helper follows for attribute pass-through, custom classes, model binding and links.

Starter Templates

Coming soon...

On this page