Skip to content

bannypotter/govuk-frontend-aspnetcore

 
 

Repository files navigation

ASP.NET Core MVC tag helpers for GOV.UK Design System

ci Nuget (with prereleases)

Targets GDS Frontend v4.1.0

Installation

1. Install NuGet package

Install the GovUk.Frontend.AspNetCore NuGet package:

Install-Package GovUk.Frontend.AspNetCore

Or via the .NET Core command line interface:

dotnet add package GovUk.Frontend.AspNetCore

2. Configure your ASP.NET Core application

Add services to your application's Startup class:

using GovUk.Frontend.AspNetCore;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddGovUkFrontend();
    }
}

This will register a Tag Helper Component that automatically adds stylesheet and script imports to your Razor views. If you do not want this then use the overload of AddGovUkFrontend that takes an Action<GovUkFrontendAspNetCoreOptions> argument and set AddImportsToHtml to false:

services.AddGovUkFrontend(options =>
{
    options.AddImportsToHtml = false;
});

3. Register tag helpers

In your _ViewImports.cshtml file:

@addTagHelper *, GovUk.Frontend.AspNetCore

GDS assets

This package serves the GDS Frontend assets (stylesheets, javascript, fonts) inside the host application so these do not need to be imported separately.

Components

Validators

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 97.5%
  • HTML 2.5%