Blazor.DriverJs 1.2.2

dotnet add package Blazor.DriverJs --version 1.2.2
NuGet\Install-Package Blazor.DriverJs -Version 1.2.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="Blazor.DriverJs" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blazor.DriverJs --version 1.2.2
#r "nuget: Blazor.DriverJs, 1.2.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.
// Install Blazor.DriverJs as a Cake Addin
#addin nuget:?package=Blazor.DriverJs&version=1.2.2

// Install Blazor.DriverJs as a Cake Tool
#tool nuget:?package=Blazor.DriverJs&version=1.2.2

Blazor DriverJs

C# wrapper for driverjs library

Installation

dotnet add package Blazor.DriverJs

Add to head

<link rel="stylesheet" href="_content/Blazor.DriverJs/driverjs.css">

Add to body

<script src="_content/Blazor.DriverJs/driverjs.js"></script>

Register service to DI

builder.Services.RegisterDriverJs();

Examples

Default drive

The DriverStore component is used here to store references to Popovers and to run the drive.

DriverJsPopover is a component that represents a popover in which we specify the step in which it will be called by passing parameters such as title, description, ...

DriverJsPopoverId analogous to DriverJsPopover, but in this place there is a link to the element id.

To be able to work with DriverStore we must declare a reference variable to interact with the API.

<button @onclick="async () => await _store.StartDrive()">
    Start drive
</button>

<div class="gallery__wrapper">
    <DriverStore @ref="_store">
        <DriverJsPopover Step="1" Title="It's a fish with a nice hat">
            <img src="https://i.pinimg.com/564x/d5/ba/a9/d5baa9d87ceccbcbb8c679b53dc07293.jpg" alt="">
        </DriverJsPopover>

        <DriverJsPopover Step="2" Title="It's a smiley face." Description="He's very happy...">
            <img src="https://i.pinimg.com/564x/29/70/52/2970520b7069945d60d4d3482691f9d7.jpg" alt="">
        </DriverJsPopover>

        <DriverJsPopover Step="3" Title="And that's a cool smiley face">
            <img src="https://i.pinimg.com/736x/40/bb/da/40bbdac7db3945f95eb9cfe572d36ecd.jpg" alt="">
        </DriverJsPopover>

        <DriverJsPopoverId Step="4" Title="Hello World">
            <img src="https://i.pinimg.com/736x/40/bb/da/40bbdac7db3945f95eb9cfe572d36ecd.jpg" alt=""
                 id="@context">
        </DriverJsPopoverId>
    </DriverStore>
</div>

@code {

  private DriverStore _store;

}

Highlight

To highlight a single object, we can use the DriverJs service and call the Highlight method by passing it a HighlightModel.

<button @onclick="ClickHandler" @ref="_ref">
    Click me
</button>

<button @onclick="ClickHandler2" id="super-button">
    Click me
</button>

@code {

  private ElementReference _ref;

  private async Task ClickHandler()
  {
      await DriverJs.Highlight(new HighlightModel(_ref)
      {
          Title = "Hello World",
      });
  }

  private async Task ClickHandler2()
  {
      await DriverJs.Highlight(new HighlightModel("super-button")
      {
          Title = "Hello World",
      });
  }

}

Get current step

To get the step number, subscribe to the OnNextStep event, which returns the step number.

To retrieve the Popover model, utilize the DriverStore reference object, which includes the Popovers parameter.

<DriverStore @ref="_store" OnNextStep="NextStepHandler"></DriverStore>

@code {

    private DriverStore _store;

    private async Task NextStepHandler(int index)
    {
        var currentPopover = _store.Popovers[index];
    }

}

Preview

record

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
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
1.2.2 84 5/14/2024
1.2.1 105 3/16/2024
1.2.0 91 3/16/2024
1.0.1 175 12/22/2023
1.0.0 83 12/21/2023