A base component library based on the Material specification and Blazor interaction capabilities

A base component library based on the Material specification and Blazor interaction capabilities

2022-10-09 0 1,551
Resource Number 44090 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue recommends MASA Blazor, a base component library that provides standards based on the Material design specification and the interaction capabilities of BlazorComponent.

A base component library based on the Material specification and Blazor interaction capabilities插图

MASA Blazor is a standard base component library based on the Material design specification and the interaction capabilities of BlazorComponent. Provides preset components for standard scenarios such as layout, popover standards, Loading, and global exception handling. Starting from more actual scenarios, meet the needs of more users and scenarios, and minimize the time cost of developers.

class=”pgc-h-arrow-right” data-track=”5″>

  • Use C# instead of JavaScript to create informative interactive UI
  • Share server-side and client-side application logic written in.NET
  • Render UI as HTML and CSS to support many browsers, including mobile
  • Integration with new hosting platforms (such as Docker)
  • Write code in C# instead of JavaScript
  • Leveraging the existing.NET library ecosystem
  • Share application logic between server and client
  • Benefit from.NET performance, reliability, and security
  • Stay productive with Visual Studio on Windows, Linux, and macOS
  • is based on a stable, feature-rich, and easy-to-use set of common languages, frameworks, and tools for generating

class=”pgc-h-arrow-right” data-track=”20″>

dependent environment

  • Install. NET SDK 6.0
  • Install Visual Studio Code or Visual Studio 2022

development environment setup

Install:

dotnet new --install  Masa.Template

Create project:

dotnet new masabp -o Masa.Test
  • Blazor WebAssembly
dotnet new masabp --mode Wasm -o Masa.TestWasm
  • Blazor RCL
dotnet new masabp --mode ServerAndWasm -o Masa.TestRcl

Run:

cd Masa.Test\Masa.Test.Server
dotnet run

A base component library based on the Material specification and Blazor interaction capabilities插图1


Existing items

Install Nuget package:

dotnet add package Masa.Blazor

< p data – track = “40” > to Masa. Blazor related services added to the Startup. ConfigureServices: < / p >

services.AddMasaBlazor(); 

Introduce styles, fonts, scripts in wwwroot/index.html(WebAssembly) or Pages/_Host.cshtml(Server) :

<html lang="en">
	<head>
		<!--Style-->
		<link href="_content/Masa.Blazor/css/masa-blazor.css" rel="stylesheet">
		<link href="_content/Masa.Blazor/css/masa-extend-blazor.css" rel="stylesheet">
		<!--Font-->
		<link href="https://cdn.jsdelivr.net/npm/@("@mdi")/font@5.x/css/materialdesignicons.min.css" rel="stylesheet">
		<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
		<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">	
	</head>
	<body>
		<!--Script (try to put it at the end of the body)-->
		<script src="_content/BlazorComponent/js/blazor-component.js"></script>
	</body>
</html>

Add namespace to _Imports.razor file :

@using Masa.Blazor
@using BlazorComponent

Modify the Shared/MainLayout.razor file to make MApp the root element:

< MApp>
	// Other layout content 
</MApp>

class=”pgc-h-arrow-right” data-track=”100″> Browser support

browser name

Support status

Chromium (Chrome, Edge Insider)

Support

Edge

Support

Firefox

Support

Safari 10+

Support

IE11/Safari 9

Support (polyfill)

IE9 / IE10

Not supported

Sample component

Alert

A base component library based on the Material specification and Blazor interaction capabilities插图2

@using AlertTypes = BlazorComponent.AlertTypes

<div>
    <MAlert Dense
            Type="AlertTypes.Info">
        I'm a dense alert with a <strong>type</strong> of info
    </MAlert>
    <MAlert Dense
            Text
            Type="AlertTypes.Success">
        I'm a dense alert with the <strong>text</strong> prop and a <strong>type</strong> of success
    </MAlert>
    <MAlert Dense
            Border="Borders.Left"
            Type="AlertTypes.Warning">
        I'm a dense alert with the <strong>border</strong> prop and a <strong>type</strong> of warning
    </MAlert>
    <MAlert Dense
            Outlined
            Type="AlertTypes.Error">
        I'm a dense alert with the <strong>outlined</strong> prop and a <strong>type</strong> of error
    </MAlert>
</div>

Avatar Picture of head

<div class="text-center" style="width:100%">
    <MAvatar Color="primary" Size="56">
        <span class="white--text">VJ</span>
    </MAvatar>
</div>

Button Push button

A base component library based on the Material specification and Blazor interaction capabilities插图3

<div class="text-center">
    <MButton class="mx-2"
             Fab
             Small
             Dark
             Color="primary">
        <MIcon>
            mdi-minus
        </MIcon>
    </MButton>

    <MButton class="mx-2"
             Fab
             Small
             Dark
             Color="pink">
        <MIcon>mdi-heart</MIcon>
    </MButton>

    <MButton class="mx-2"
             Fab
             Dark
             Color="indigo">
        <MIcon>mdi-plus</MIcon>
    </MButton>

    <MButton class="mx-2"
             Fab
             Dark
             Color="teal">
        <MIcon>mdi-format-list-bulleted-square</MIcon>
    </MButton>

    <MButton class="mx-2"
             Fab
             Dark
             Large
             Color="cyan">
        <MIcon>mdi-pencil</MIcon>
    </MButton>

    <MButton class="mx-2"
             Fab
             Dark
             Large
             Color="purple">
        <MIcon>
            mdi-android
        </MIcon>
    </MButton>
</div>

Dialog 对话框

A base component library based on the Material specification and Blazor interaction capabilities插图4

<MRow Justify="JustifyTypes.SpaceAround">
    <MCol Cols="@("auto")">
        <MDialog @bind-Value="dialog"
                 Transition="dialog-bottom-transition"
                 MaxWidth="600">
            <ActivatorContent>
                <MButton Color="primary"
                         @attributes="@context.Attrs">
                    From the bottom
                </MButton>
            </ActivatorContent>
            <ChildContent>
                <MCard>
                    <MToolbar Color="primary"
                              Dark>
                        Opening from the bottom
                    </MToolbar>
                    <MCardText>
                        <div class="text-h2 pa-12">Hello world!</div>
                    </MCardText>
                    <MCardActions Class="justify-end">
                        <MButton Text
                                 OnClick="() => dialog = false">
                            Close
                        </MButton>
                    </MCardActions>
                </MCard>
            </ChildContent>
        </MDialog>
    </MCol>
</MRow>

Tab TAB TAB

A base component library based on the Material specification and Blazor interaction capabilities插图5

<MCard>
    <MTabs BackgroundColor="deep-purple accent-4" CenterActive Dark>
        <MTab>One</MTab>
        <MTab>Two</MTab>
        <MTab>Three</MTab>
        <MTab>Four</MTab>
        <MTab>Five</MTab>
        <MTab>Six</MTab>
        <MTab>Seven</MTab>
        <MTab>Eight</MTab>
        <MTab>Nine</MTab>
        <MTab>Ten</MTab>
        <MTab>Eleven</MTab>
        <MTab>Twelve</MTab>
        <MTab>Thirteen</MTab>
        <MTab>Fourteen</MTab>
        <MTab>Fifteen</MTab>
        <MTab>Sixteen</MTab>
        <MTab>Seventeen</MTab>
        <MTab>Eighteen</MTab>
        <MTab>Nineteen</MTab>
        <MTab>Twenty</MTab>
    </MTabs>
</MCard>

Reference for more sample components:
https://blazor-wasm.masastack.com/components/alerts

—END—

Open source protocol: MIT

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code A base component library based on the Material specification and Blazor interaction capabilities https://ictcoder.com/a-basic-component-library-based-on-material-specifications-and-blazor-interaction-capabilities/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services