Gizmo.Web.JSInterop 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Gizmo.Web.JSInterop --version 1.0.1
                    
NuGet\Install-Package Gizmo.Web.JSInterop -Version 1.0.1
                    
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="Gizmo.Web.JSInterop" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Gizmo.Web.JSInterop" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Gizmo.Web.JSInterop" />
                    
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 Gizmo.Web.JSInterop --version 1.0.1
                    
#r "nuget: Gizmo.Web.JSInterop, 1.0.1"
                    
#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 Gizmo.Web.JSInterop@1.0.1
                    
#: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=Gizmo.Web.JSInterop&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Gizmo.Web.JSInterop&version=1.0.1
                    
Install as a Cake Tool

Gizmo.Web.JSInterop

A .NET library providing JavaScript interoperability functions for Blazor applications.

Requirements

  • .NET 9.0
  • Blazor WebAssembly or Blazor Server

Installation

Add a reference to the Gizmo.Web.JSInterop package in your Blazor project:

dotnet add package Gizmo.Web.JSInterop

Features

Clipboard API

  • Permission Management

    • Check clipboard read permissions
    • Check clipboard write permissions
  • Text Operations

    • Read text from clipboard
    • Write text to clipboard
  • Image Operations

    • Read images from clipboard
    • Write images to clipboard
  • Advanced Operations

    • Write multiple formats (text and image) simultaneously

Usage Examples

Basic Clipboard Operations
@inject IJSRuntime jsRuntime

@code {
    var clipboardApi = new ClipboardApi(jsRuntime);
    
    private async Task CopyTextToClipboard(string text)
    {
        if (await clipboardApi.CanWrite())
        {
            await clipboardApi.WriteText(text);
        }
    }

    private async Task<string> GetTextFromClipboard()
    {
        if (await clipboardApi.CanRead())
        {
            return await clipboardApi.ReadText();
        }
        return string.Empty;
    }
}
Working with Images
@inject IJSRuntime jsRuntime

@code {
    var clipboardApi = new ClipboardApi(jsRuntime);
    
    private async Task CopyImageToClipboard(byte[] imageData)
    {
        if (await clipboardApi.CanWrite())
        {
            await clipboardApi.WriteImage(imageData, "image/png");
        }
    }
    
    private async Task<byte[]?> GetImageFromClipboard()
    {
        if (await clipboardApi.CanRead())
        {
            return await clipboardApi.ReadImage();
        }
        return null;
    }
}
Browser Compatibility

The Clipboard API relies on the browser's implementation of the Clipboard API. Functionality may vary depending on:

  • Browser vendor and version
  • Security context (HTTPS is generally required)
  • User permissions and browser settings

Most modern browsers (Chrome, Edge, Firefox, Safari) support the core clipboard functionality, but permission handling may differ between implementations.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.0-preview 344 6/12/2025
1.0.2 87 2/24/2026
1.0.1 235 4/29/2025
1.0.0 392 4/24/2025