Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

A Blazor component library for interacting with the browser clipboard

License

Notifications You must be signed in to change notification settings

Basaingeal/Blazor.Clipboard

Repository files navigation

CurrieTechnologies.Blazor.Clipboard

This package provides Blazor applications with access to the browser's Clipboard API

This package is depracted. Use CurrieTechnologies.Razor.Clipboard

Usage

  1. In your Blazor app, add the CurrieTechnologies.Blazor.Clipboard NuGet package

    Install-Package CurrieTechnologies.Blazor.Clipboard
    
  2. In your Blazor app's Startup.cs, register the 'ClipboardService'.

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddClipboard();
        ...
    }
    
  3. Now you can inject the ClipboardService into any Blazor page and use it like this:

    @using CurrieTechnologies.Blazor.Clipboard
    @inject ClipboardService clipboard
    
    <input @bind="@textValue" />
    <button @onclick="@(async e => await clipboard.WriteTextAsync(textValue))">Copy To Clipboard</button>
    <button @onclick="@(async e => textValue = await clipboard.ReadTextAsync())">Paste From Clipboard</button>
    
    @code
    {
        string textValue = string.Empty;
    }
    

About

A Blazor component library for interacting with the browser clipboard

Resources

License

Stars

Watchers

Forks

Packages

No packages published