Gizmo.Web.JSInterop 1.0.0

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.0
                    
NuGet\Install-Package Gizmo.Web.JSInterop -Version 1.0.0
                    
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.0" />
                    
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.0" />
                    
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.0
                    
#r "nuget: Gizmo.Web.JSInterop, 1.0.0"
                    
#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.0
                    
#: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.0
                    
Install as a Cake Addin
#tool nuget:?package=Gizmo.Web.JSInterop&version=1.0.0
                    
Install as a Cake Tool

Gizmo.Web.JSInterop

Gizmo.Web.JSInterop

A JavaScript interop library for Blazor applications that provides seamless clipboard access functionality.

Features

  • Read and write text to/from clipboard
  • Read and write images to/from clipboard
  • Check clipboard permissions
  • Multi-item clipboard operations

Installation

Install the package from NuGet: A .NET library providing JavaScript interoperability functions for Blazor applications.

Features

Clipboard API

The library provides comprehensive clipboard functionality for Blazor applications:

  • Check clipboard read/write permissions
  • Read text from clipboard
  • Write text to clipboard
  • Read images from clipboard
  • Write images to clipboard
  • Write multiple formats (text and image) simultaneously

Usage

Installation

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

dotnet add package Gizmo.Web.JSInterop

Register Services

In your Blazor application's Program.cs or Startup.cs:

builder.Services.AddScoped<Gizmo.Web.JSInterop.ClipboardApi>();

Import JavaScript

In your _Imports.razor or component:

@using Gizmo.Web.JSInterop

Use the Clipboard API

@inject ClipboardApi ClipboardApi

@code {
    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;
    }
}

Requirements

  • .NET 9.0
  • Blazor WebAssembly or Blazor Server

Browser Compatibility

The Clipboard API relies on the browser's implementation of the Clipboard API. Functionality may vary depending on the browser and security context (HTTPS is generally required for clipboard operations).

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 236 4/29/2025
1.0.0 393 4/24/2025