Swagger.Bootstrap 2.0.2

dotnet add package Swagger.Bootstrap --version 2.0.2
                    
NuGet\Install-Package Swagger.Bootstrap -Version 2.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Swagger.Bootstrap" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Swagger.Bootstrap" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Swagger.Bootstrap" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Swagger.Bootstrap --version 2.0.2
                    
#r "nuget: Swagger.Bootstrap, 2.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Swagger.Bootstrap@2.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Swagger.Bootstrap&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Swagger.Bootstrap&version=2.0.2
                    
Install as a Cake Tool

<div align="center">

Latest Release License: NonCommercial Open Issues Stars

</div>

Swagger.Bootstrap

Swagger.Bootstrap is an add-on for Swagger UI that gives it a modern Bootstrap look and feel.
It also adds a simple theme switcher so users can toggle between Light, Dark, Oled and System.

✨ Features

  • Bootstrap-inspired styling for Swagger UI
  • Built-in theme switcher (light/dark)
  • Navigation & Tool menus (Experimental)
  • Authentication window, to authorize Swagger using JWT.
  • Easy integration with ASP.NET Core Swagger setup

📂 Getting Started

1. NuGet package manager

Install using the NuGet package manager or by running one of the following commands.

dotnet add package Swagger.Bootstrap
Install-Package Swagger.Bootstrap

Version 2.X (NEW)

Version 2.X has returned to UseSwaggerBootstrap instead of UseSwaggerUI

In your Program.cs or Startup.cs, add the following methods.

builder.Services.AddSwaggerBootstrap();

Or

// All variables are optional.
builder.Services.AddSwaggerBootstrap(options =>
{
    // Enables the experimental features,
    // including navigation & tools.
    options.UseExperimentalFeatures = true;
    // Enables the login page and button.
    options.UseAuthentication = true;
    // The endpoint to call during login.
    options.loginOptions.LoginEndpoint = "/auth/login";
    // The variable to use for authentication, when login succeeds.
    options.loginOptions.VariableName = "jwtToken";
    // Whether to configure the username field as text or email.
    // The label will be changed as well.
    options.loginOptions.UserNameType = UserNameType.Text;
});

Then, replace the default UseSwaggerUI with:

app.UseSwaggerBootstrap(c =>
{
    // OpenApi example, using swagger gen.
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});

UseStaticFiles is no longer needed as the resources are dynamically mapped now.

Version 1.x

In your UseSwaggerUI just add AddSwaggerBootstrap:

app.UseSwaggerUI(options =>
{
    options.AddSwaggerBootstrap();
});

To enable the experimental features, add AddExperimentalFeatures to AddSwaggerBootstrap:

options.AddSwaggerBootstrap()
        .AddExperimentalFeatures();

This setup needs UseStaticFiles to be enabled:

app.UseStaticFiles();

PRE 1.0

Configure Swagger.Bootstrap

In your Program.cs or Startup.cs, simply replace the default UseSwaggerUI with:

app.UseSwaggerBootstrap(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});

Or if you want to keep your existing SwaggerUI configuration:
(app.UseStaticFiles must be set)

app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
    c.AddSwaggerBootstrap();
});

app.UseStaticFiles();

2. Manual installation

Download the files

Copy the provided swagger.bootstrap.min.css and swagger.bootstrap.min.js files into your projects static file location, wwwroot.

Enable static files

Add the following, to your Program.cs or Startup.cs

app.UseStaticFiles();

Inject into Swagger UI

app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");

    // Inject custom CSS
    c.InjectStylesheet("/swagger.bootstrap.min.css");

    // Inject custom JavaScript
    c.InjectJavascript("/swagger.bootstrap.min.js");
});
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.2 155 3/22/2026
2.0.1 111 3/10/2026
2.0.0 105 3/9/2026
1.2.0 110 3/5/2026
1.1.1 675 12/11/2025
1.1.0 368 12/8/2025
1.0.7 212 12/4/2025
1.0.6 384 10/17/2025
1.0.4 166 10/17/2025
1.0.3 226 9/7/2025
1.0.2 186 9/6/2025
1.0.1 172 9/6/2025
1.0.0 205 9/2/2025