Gizmo.Web.JSInterop
1.0.1
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
<PackageReference Include="Gizmo.Web.JSInterop" Version="1.0.1" />
<PackageVersion Include="Gizmo.Web.JSInterop" Version="1.0.1" />
<PackageReference Include="Gizmo.Web.JSInterop" />
paket add Gizmo.Web.JSInterop --version 1.0.1
#r "nuget: Gizmo.Web.JSInterop, 1.0.1"
#:package Gizmo.Web.JSInterop@1.0.1
#addin nuget:?package=Gizmo.Web.JSInterop&version=1.0.1
#tool nuget:?package=Gizmo.Web.JSInterop&version=1.0.1
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 | Versions 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. |
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.3)
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 |