CrahunBlazorComponents 2.5.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package CrahunBlazorComponents --version 2.5.5
NuGet\Install-Package CrahunBlazorComponents -Version 2.5.5
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="CrahunBlazorComponents" Version="2.5.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CrahunBlazorComponents --version 2.5.5
#r "nuget: CrahunBlazorComponents, 2.5.5"
#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.
// Install CrahunBlazorComponents as a Cake Addin
#addin nuget:?package=CrahunBlazorComponents&version=2.5.5

// Install CrahunBlazorComponents as a Cake Tool
#tool nuget:?package=CrahunBlazorComponents&version=2.5.5

BlazorComponents

Useful blazor components

Installation

You can install package from nuget

<PackageReference Include="CrahunBlazorComponents" Version="2.5.5" />

Add bootstrap 4 Css

This library relies on bootstrap 4 so if need it you can link it from the library

<link href="_content/CrahunBlazorComponents/bootstrap/bootstrap.min.css" rel="stylesheet" />

Add global import in _Imports.razor

@using CrahunComponents

Skeleton table component

<SkeletonTable NumberOfColumns="4" IsLoading="isLoading" ShouldAnimate="true">
    <ChildContent>
        <tr>
            <td>
                Value1
            </td>
            <td>
                Value2
            </td>
        </tr>
    </ChildContent>
    <Head>
        <tr>
            <th>
                Column1
            </th>
            <th>
                Column2
            </th>
        </tr>
    </Head>
</SkeletonTable>

<img src="https://github.com/crahungit/BlazorComponents/blob/master/table.gif?raw=true" width="100%" />


 

Skeleton cards

<SkeletonCards IsLoading="isLoading" ShouldAnimate="true">
    <div class="col-sm-4">
        <div class="card">
            <div class="card-header" data-simplebar>
                <h3 class="card-title">Title</h3>
            </div>
            <div class="card-body" data-simplebar>
                This is the body
            </div>
            <div class="card-footer text-right">
                This is the footer
            </div>
        </div>
    </div>
</SkeletonCards>

<img src="https://github.com/crahungit/BlazorComponents/blob/master/cards.gif?raw=true" width="100%" />


 

Wizard Component

The wizard component Will show steps in certain order. Steps can contains any other components, html or whatever you want. This component is based on creative Tim jquery wizard. <img src="https://github.com/crahungit/BlazorComponents/blob/master/wizard.gif?raw=true" width="100%" />

Usage

<Wizard Title="Wizard" Theme="Theme.Orange">
    <Step Name="Step 1">
        <div>Hi step 1</div>
    </Step>
    <Step Name="Step 2">
        <div>Hi step 2</div>
    </Step>
    <Step>
        <table>
            <thead>
                <tr>
                    <th>Id</th>
                    <th>Name</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>Name</td>
                </tr>
            </tbody>
        </table>
    </Step>
    <Step Name="Step 3">
        <div>Adios paso 4</div>
    </Step>
    <Step>
        <div>Hi step 3</div>
    </Step>
</Wizard>

Available parameters and customizations

First you can customize the wizard colors with de Theme enum

public enum Theme
{
    Purple,
    Green,
    Blue,
    Orange,
    Red
}

You can customize the buttons meaning and color with the Buttons enum

public enum Buttons
{
    Default,
    Simple,
    Primary,
    Info,
    Success,
    Warning,
    Danger
}

Callback events on buttons/tabs

[Parameter]
public EventCallback OnPrevious { get; set; }

[Parameter]
public EventCallback OnNext { get; set; }

[Parameter]
public EventCallback OnFinished { get; set; }

[Parameter]
public EventCallback<int> OnSelectedStep { get; set; }

Buttons appearence customization

[Parameter]
public Buttons PreviousButtonClass { get; set; } = Buttons.Default;

[Parameter]
public Buttons NextButtonClass { get; set; } = Buttons.Danger;

[Parameter]
public Buttons FinishButtonClass { get; set; } = Buttons.Danger;

[Parameter]
public string NextButtonText { get; set; } = "Next";

[Parameter]
public string PreviousButtonText { get; set; } = "Previous";

[Parameter]
public string FinishedButtonText { get; set; } = "Finished";

Available public methods

IsFirstStep()
IsLastStep()
SetActivePage(int currentIndex)
NextPage()
PreviousPage()


 

LazyImageComponent

This component will show any image with transitions when it's fully loaded. When it's loading it will show an skeleton ui or whaterever you like.

Usage

<LazyImage ImageUrl="@($"{configuration["Urls:AuthServer"]}/images/Uploaded/{Category.PhotoUrl}")"
                           Alternative="@Category.Name" AdditionalClasses="img-responsive">
</LazyImage>

Available parameters and customizations

You can customize the image itself with the following params

[Parameter]
public string ImageUrl { get; set; }

[Parameter]
public string Alternative { get; set; }

[Parameter]
public string AdditionalStyles { get; set; }

[Parameter]
public string AdditionalClasses { get; set; }

[Parameter]
public string ImagePlaceHolderWidth { get; set; } = "100%";
    
[Parameter]
public int ImagePlaceHolderHeight { get; set; } = 200";

[Parameter]
public RenderFragment LoadingPlaceHolder { get; set; }

The loading placeholder is just a div that will show when image is loading. By default is a skeleton-ui but can be replaced by spinner or whatever you need. <img src="https://github.com/crahungit/BlazorComponents/blob/master/lazyImageSample.gif?raw=true" width="100%" />

DragDropUploadFile

This component will wrap the blazor InputFile component with the ability to paste from image and drag and drop files. It supports image preview and customizations.<br /><br /> This component is based and adapted from Meziantou's blog. All the effort is from him.

<img src="https://github.com/crahungit/BlazorComponents/blob/master/uploadfiles.gif?raw=true" width="100%" />

Usage

  1. Basic usage
<DragDropUploadFile />
  1. Customized usage
<div class="row">
    <div class="col-10">
        <DragDropUploadFile OnFileSelectionChanged="OnChange" ShowImage="false" InformationText="Sample to upload file with custom format"/>
    </div>
    <div class="col-2">
        <img src="@src" style="max-width: 100%" />
    </div>
</div>

And the corresponding code

@code {
    string src;

    // Called when a new file is uploaded
    async Task OnChange(InputFileChangeEventArgs e)
    {
        using var stream = e.File.OpenReadStream();
        using var ms = new MemoryStream();
        await stream.CopyToAsync(ms);
        src = "data:" + e.File.ContentType + ";base64," + Convert.ToBase64String(ms.ToArray());
    }
}

Available parameters and customizations

You can customize this component with the following params

[Parameter]
public string InformationText { get; set; }

[Parameter]
public bool ShowImage { get; set; }

[Parameter]
public EventCallback<InputFileChangeEventArgs> OnChangeImage { get; set; }

InputSwitch

This component wraps boolean value inside a customizable switch intead of checkbox. It allows doble-way binding as any other blazor input component.

<br/> <p align="center"> <img src="https://github.com/crahungit/BlazorComponents/blob/master/switch.gif?raw=true" width="40%" /> </p>

Usage

<EditForm Model="person">
    <InputSwitch Label="Are you adult?" @bind-Value="@person.IsAdult"></InputSwitch>
</EditForm>

Available parameters and customizations

You can customize this component itself with the following params

[Parameter]
public string Label { get; set; }

[Parameter]
public bool Value { get; set; }

[Parameter]
public EventCallback<bool> ValueChanged { get; set; }

LoadingButton

This component shows button text or bootstrap spinner while controlling its IsLoading property.

<br/> <p align="center"> <img src="https://github.com/crahungit/BlazorComponents/blob/master/LoadingButton.gif?raw=true" width="40%" /> </p>

Usage

<div class="d-flex">
    <LoadingButton OnClick="ToggleButton" @bind-IsLoading="isLoading" class="btn btn-primary mt-3 ms-auto me-auto" type="submit">
        <LoadingTemplate>
            <div class="d-flex">
                <span class="spinner-border ms-auto me-auto" role="status" style="color: red">
                    <span class="sr-only">Loading...</span>
                </span>
            </div>
        </LoadingTemplate>
        <ButtonTextTemplate>
            <span>Hola</span>
        </ButtonTextTemplate>
    </LoadingButton>
</div>

Available parameters and customizations

You can customize this component itself with the following params

[Parameter]
public bool IsLoading { get; set; }

[Parameter]
public EventCallback<bool> IsLoadingChanged { get; set; }

[Parameter]
public RenderFragment ButtonTextTemplate { get; set; }

[Parameter]
public RenderFragment LoadingTemplate { get; set; }

[Parameter]
public EventCallback<bool> OnClick { get; set; }

[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> AdditionalProperties { get; set; }
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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
3.2.2 213 11/30/2023
3.2.1 297 6/29/2023
3.1.0 164 6/16/2023
3.0.1 148 6/13/2023
2.5.9 306 2/2/2023
2.5.5 447 10/19/2022
2.5.3 416 10/9/2022
2.5.2 381 10/4/2022
2.4.2 499 3/6/2022
2.4.1 421 2/13/2022
2.4.0 447 2/3/2022
2.3.7 392 9/14/2021
2.3.3 376 8/9/2021
2.2.2 377 5/17/2021
2.2.1 345 5/12/2021
2.2.0 364 5/7/2021
2.1.4 347 5/5/2021
2.1.3 391 4/24/2021
2.1.2 368 4/21/2021
2.1.1 367 4/21/2021
2.0.0 348 4/19/2021
1.3.0 370 3/29/2021
1.2.5 412 3/24/2021
1.2.4 402 3/23/2021
1.1.1 384 3/20/2021
1.1.0 380 3/18/2021
1.0.5 400 11/18/2020
1.0.4 430 11/18/2020