Coder Social home page Coder Social logo

toolbelt.blazor.copybuttonizer's Introduction

Blazor Copy Buttonizer NuGet Package

Summary

This is a component for Blazor apps to append "Copy to clipboard" button.

movie.1

Installation

  1. Add the "Toolbelt.Blazor.CopyButtonizer" NuGet package to your Blazor application project.
dotnet add package Toolbelt.Blazor.CopyButtonizer
  1. To be convinience, open the Toolbelt.Blazor.CopyButtonizer name space globally.
@* _Import.razor *@
...
@* πŸ‘‡ Open this name space. *@
@using Toolbelt.Blazor.CopyButtonizer

Usage

Surround the contents what you want to add "Copy to clipboard" button with a <CopyButtonize> component.

@* *.razor *@
...
<CopyButtonize>
  <input type="text" .../>
</CopyButtonize>
...

After doing that, the button to copy to the clipboard will be appended to the child's contents, which the CopyButtonize component surrounds.

fig.1

API

CopyButtonize component exposes the following properties.

Property Name Type Description
Title string Specify the tooltip text of the "copy to clipboard" button.
Position CopyButtonPosition Specify the layout position of the "copy to clipboard" button. (The default value is "Bottom".)
Class string Specify the CSS class name that will apply to the container element of the CopyButtonize component.
ContainerStyle string Specify the inline styles that will apply to the container element of the CopyButtonize component.
ButtonStyle string Specify the inline styles that will apply to the button element of the CopyButtonize component.
Copied EventCallback Specify the event handler when copying to clipboard was fired.

Configure default settings

You can configure the default settings of the CopyButtonize component globally in your start-up code. (See the following example.)

// Program.cs

// πŸ‘‡ Open these name spaces.
using Toolbelt.Blazor.CopyButtonizer;
using Toolbelt.Blazor.Extensions.DependencyInjection;
...
var builder = WebAssemblyHostBuilder.CreateDefault(args);
...

// πŸ‘‡ Call "AddCopyButtonizeOptions()" method 
//    to configure the "CopyButtonize" component's options globally.
builder.Services.AddCopyButtonizeOptions(options =>
{
    options.GetTitle = services => "Copy to clipboard.";
    options.GetPosition = services => CopyButtonPosition.Top;
});
...

Supported versions

Both Blazor WebAssembly and Blazor Server apps on .NET 6 or later are supported.

Release notes

The release notes is here.

License

Mozilla Public License Version 2.0

toolbelt.blazor.copybuttonizer's People

Contributors

jsakamoto avatar

Stargazers

NAKIGOE.ORG avatar Dennis Rahmen avatar  avatar Miguel Pimenta avatar Abdul Rahman avatar Jan TesaΕ™ avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.