ant-design-blazor/README.md

239 lines
16 KiB
Markdown
Raw Normal View History

2019-12-26 15:50:38 +08:00
<p align="center">
<a href="https://yangshunjie.com/ant-design-blazor/">
2020-12-08 19:32:38 +08:00
<img src="https://cdn.jsdelivr.net/gh/ant-design-blazor/ant-design-blazor/logo.svg?sanitize=true">
2019-12-26 15:50:38 +08:00
</a>
</p>
<h1 align="center">Ant Design Blazor</h1>
<div align="center">
2021-11-09 18:10:55 +08:00
A rich set of enterprise-class UI components based on Ant Design and Blazor.
2019-12-26 15:50:38 +08:00
2020-04-28 00:13:43 +08:00
![](https://img.shields.io/github/workflow/status/ant-design-blazor/ant-design-blazor/Publish%20Docs?style=flat-square)
[![AntDesign](https://img.shields.io/nuget/v/AntDesign.svg?color=red&style=flat-square)](https://www.nuget.org/packages/AntDesign/)
[![AntDesign](https://img.shields.io/nuget/dt/AntDesign.svg?style=flat-square)](https://www.nuget.org/packages/AntDesign/)
2020-11-20 12:52:12 +08:00
[![AntDesign.Templates](https://img.shields.io/nuget/v/AntDesign.Templates?color=%23512bd4&label=Templates&style=flat-square)](https://github.com/ant-design-blazor/ant-design-pro-blazor)
[![codecov](https://img.shields.io/codecov/c/github/ant-design-blazor/ant-design-blazor/master.svg?style=flat-square)](https://codecov.io/gh/ant-design-blazor/ant-design-blazor)
[![AntDesign](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](https://github.com/ant-design-blazor/ant-design-blazor/blob/master/LICENSE)
[![Ding Talk Group](https://img.shields.io/badge/DingTalk-AntBlazor-blue.svg?style=flat-square&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg0KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpY29uIiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSIjZmZmZmZmIj4NCiAgPHBhdGggZD0iTTU3My43IDI1Mi41QzQyMi41IDE5Ny40IDIwMS4zIDk2LjcgMjAxLjMgOTYuN2MtMTUuNy00LjEtMTcuOSAxMS4xLTE3LjkgMTEuMS01IDYxLjEgMzMuNiAxNjAuNSA1My42IDE4Mi44IDE5LjkgMjIuMyAzMTkuMSAxMTMuNyAzMTkuMSAxMTMuN1MzMjYgMzU3LjkgMjcwLjUgMzQxLjljLTU1LjYtMTYtMzcuOSAxNy44LTM3LjkgMTcuOCAxMS40IDYxLjcgNjQuOSAxMzEuOCAxMDcuMiAxMzguNCA0Mi4yIDYuNiAyMjAuMSA0IDIyMC4xIDRzLTM1LjUgNC4xLTkzLjIgMTEuOWMtNDIuNyA1LjgtOTcgMTIuNS0xMTEuMSAxNy44LTMzLjEgMTIuNSAyNCA2Mi42IDI0IDYyLjYgODQuNyA3Ni44IDEyOS43IDUwLjUgMTI5LjcgNTAuNSAzMy4zLTEwLjcgNjEuNC0xOC41IDg1LjItMjQuMkw1NjUgNzQzLjFoODQuNkw2MDMgOTI4bDIwNS4zLTI3MS45SDcwMC44bDIyLjMtMzguN2MuMy41LjQuOC40LjhTNzk5LjggNDk2LjEgODI5IDQzMy44bC42LTFoLS4xYzUtMTAuOCA4LjYtMTkuNyAxMC0yNS44IDE3LTcxLjMtMTE0LjUtOTkuNC0yNjUuOC0xNTQuNXoiLz4NCjwvc3ZnPg0K)](https://h5.dingtalk.com/circle/healthCheckin.html?corpId=dingf3df1949a4aa48627b0128d9a44ecb79&c5df5865-4f41-=be1b34c7-397b-&cbdbhh=qwertyuiop&origin=11)
[![Discord Server](https://img.shields.io/discord/753358910341251182?color=%237289DA&label=AntBlazor&logo=discord&logoColor=white&style=flat-square)](https://discord.com/invite/jqu3Xeq)
2019-12-26 15:50:38 +08:00
</div>
2020-03-14 15:19:36 +08:00
2020-06-20 01:03:06 +08:00
[![](https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*Yl83RJhUE7kAAAAAAAAAAABkARQnAQ)](https://ant-design-blazor.github.io)
2020-03-28 18:28:30 +08:00
English | [简体中文](README-zh_CN.md)
2020-03-14 15:19:36 +08:00
## ✨ Features
2020-04-24 10:34:54 +08:00
- 🌈 Enterprise-class UI designed for web applications.
- 📦 A set of high-quality Blazor components out of the box.
- 💕 Supports WebAssembly-based client-side and SignalR-based server-side UI event interaction.
- 🎨 Supports Progressive Web Applications (PWA).
- 🛡 Build with C#, a multi-paradigm static language for an efficient development experience.
- ⚙️ .NET Standard 2.1/.NET 5/.NET 6 based, with direct reference to the rich .NET ecosystem.
2020-04-24 10:34:54 +08:00
- 🎁 Seamless integration with existing ASP.NET Core MVC and Razor Pages projects.
## 🌈 Online Examples
2020-03-14 15:19:36 +08:00
WebAssembly static hosting examples:
2020-03-14 15:19:36 +08:00
2020-04-28 00:13:43 +08:00
- [GitHub](https://ant-design-blazor.github.io/)
- [Gitee](https://ant-design-blazor.gitee.io/)
2020-03-14 15:19:36 +08:00
## 🖥 Environment Support
2020-03-14 15:19:36 +08:00
- Compatible with .NET Core 3.1 / .NET 5 / .NET 6。
- Blazor WebAssembly 3.2/.NET 5 Release
- Supports two-way binding on the server side
- Supports WebAssembly static file deployment
2021-02-23 15:30:46 +08:00
- Support 4 major browsers engines, and Internet Explorer 11+ ([Blazor Server](https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-3.1&WT.mc_id=DT-MVP-5003987) only)
- Run directly on [Electron](http://electron.atom.io/) and other Web standards-based environments
2020-03-14 15:19:36 +08:00
2020-12-08 19:32:38 +08:00
| [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br> Edge / IE | [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari | [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Opera | [<img src="https://cdn.jsdelivr.net/gh/alrra/browser-logos/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Electron |
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Edge 16 / IE 11† | 522 | 57 | 11 | 44 | Chromium 57 |
2020-03-14 15:19:36 +08:00
> Due to [WebAssembly](https://webassembly.org) restriction, Blazor WebAssembly doesn't support IE browser, but Blazor Server supports IE 11† with additional polyfills. See [official documentation](https://docs.microsoft.com/en-us/aspnet/core/blazor/supported-platforms?view=aspnetcore-3.1&WT.mc_id=DT-MVP-5003987).
> From .NET 5, IE 11 is no longer officially supported. See [Blazor: Updated browser support](https://docs.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/5.0/blazor-browser-support-updated). Unofficial support is provided by [Blazor.Polyfill](https://github.com/Daddoon/Blazor.Polyfill) community project.
2020-03-14 15:19:36 +08:00
## 💿 Current Version
2020-03-14 15:19:36 +08:00
- Release: [![AntDesign](https://img.shields.io/nuget/v/AntDesign.svg?color=red&style=flat-square)](https://www.nuget.org/packages/AntDesign/)
2021-03-03 14:08:49 +08:00
- Nightly: [![AntDesign](https://img.shields.io/myget/ant-design-blazor/vpre/AntDesign?style=flat-square)](https://www.myget.org/feed/ant-design-blazor/package/nuget/AntDesign)
_[Download our latest nightly builds](docs/nightly-build.en-US.md)_
2020-03-14 15:19:36 +08:00
## 🎨 Design Specification
2020-03-14 15:19:36 +08:00
2020-04-28 00:13:43 +08:00
Regularly synchronize with Official Ant Design specifications, you can check the [sync logs](https://github.com/ant-design-blazor/ant-design-blazor/actions?query=workflow%3A%22Style+sync+Bot%22) online.
2020-03-14 15:19:36 +08:00
Therefore, you can use the custom theme styles of Ant Design directly.
## 📦 Installation Guide
2020-03-14 15:19:36 +08:00
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1?WT.mc_id=DT-MVP-5003987) 3.1.300 or later, .NET 6 is even better.
2020-11-20 12:52:12 +08:00
### Create a new project from the dotnet new template [![AntDesign.Templates](https://img.shields.io/nuget/v/AntDesign.Templates?color=%23512bd4&label=Templates&style=flat-square)](https://github.com/ant-design-blazor/ant-design-pro-blazor)
We have provided the `dotnet new` template to create a [Boilerplate](https://github.com/ant-design-blazor/ant-design-pro-blazor) project out of the box
2021-09-15 23:34:02 +08:00
![Pro Template](https://user-images.githubusercontent.com/8186664/44953195-581e3d80-aec4-11e8-8dcb-54b9db38ec11.png)
- Install the template
```bash
$ dotnet new --install AntDesign.Templates
```
- Create the Boilerplate project with the template
```bash
$ dotnet new antdesign -o MyAntDesignApp
2020-03-14 15:19:36 +08:00
```
2020-04-28 00:13:43 +08:00
Options for the template
| Options | Description | Type | Default |
| ----------------- | ------------------------------------------------------------------ | ------------------------------ | ------- |
| `-f` \| `--full` | If specified, generates all pages of Ant Design Pro | bool | false |
| `-ho` \| `--host` | Specify the hosting model | 'wasm' \| 'server' \| 'hosted' | 'wasm' |
2021-09-15 23:34:02 +08:00
| `--styles` | Whether use NodeJS and Less to compile your custom themes. | `css` \| `less` | `css` |
| `--no-restore` | If specified, skips the automatic restore of the project on create | bool | false |
### Import Ant Design Blazor into an existing project
- Go to the project folder of the application and install the Nuget package reference
2020-03-14 15:19:36 +08:00
```bash
$ dotnet add package AntDesign
2020-03-14 15:19:36 +08:00
```
2021-11-09 18:10:55 +08:00
- Register the services in `Program.cs` (client-side WebAssembly Blazor)
```csharp
builder.Services.AddAntDesign();
```
2021-11-09 18:10:55 +08:00
or `Startup.cs` (server-side Blazor)
```csharp
services.AddAntDesign();
2020-03-14 15:19:36 +08:00
```
2021-11-09 18:10:55 +08:00
- Link the static files in `wwwroot/index.html` (client-side WebAssembly Blazor) or `Pages/_Host.cshtml` (server-side Blazor)
```html
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
2020-03-14 15:19:36 +08:00
```
- Add namespace in `_Imports.razor`
```csharp
@using AntDesign
2020-03-14 15:19:36 +08:00
```
- To display the pop-up component dynamically, you need to add the `<AntContainer />` component in `App.razor`.
2020-06-20 01:03:06 +08:00
```
<Router AppAssembly="@typeof(MainLayout).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<Result Status="404" />
</LayoutView>
</NotFound>
</Router>
<AntContainer /> <-- add this component
```
2021-11-09 18:10:55 +08:00
- Finally, it can be referenced in the `.razor` component!
```razor
2021-11-09 18:10:55 +08:00
<Button Type="@ButtonType.Primary">Hello World!</Button>
2020-03-14 15:19:36 +08:00
```
## ⌨️ Local Development
2020-03-14 15:19:36 +08:00
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet/6.0?WT.mc_id=DT-MVP-5003987) 6.0.100 or later.
- Install Node.js (only for building style files and interoperable TypeScript files)
- Clone to local development
```bash
2020-04-28 00:13:43 +08:00
$ git clone git@github.com:ant-design-blazor/ant-design-blazor.git
2020-03-14 15:19:36 +08:00
$ cd ant-design-blazor
$ npm install
$ dotnet build ./site/AntDesign.Docs.Build/AntDesign.Docs.Build.csproj
2020-03-14 15:19:36 +08:00
$ npm start
```
2020-04-28 00:13:43 +08:00
- Visit https://localhost:5001 in your supported browser and check [local development documentation](https://github.com/ant-design-blazor/ant-design-blazor/wiki) for details.
> Visual Studio 2022 is recommended for development.
2020-03-14 15:19:36 +08:00
## 🔗 Links
2020-03-14 15:19:36 +08:00
- [Ant Design Blazor Documentation](https://ant-design-blazor.github.io)
2020-11-03 00:49:13 +08:00
- [Official Blazor Documentation](https://docs.microsoft.com/en-us/aspnet/core/blazor/?WT.mc_id=DT-MVP-5003987)
- [MS Learn for Blazor Tutorial](https://docs.microsoft.com/en-us/learn/modules/build-blazor-webassembly-visual-studio-code/?WT.mc_id=DT-MVP-5003987)
2020-03-14 15:19:36 +08:00
## 🗺 Roadmap
2020-03-14 15:19:36 +08:00
2020-04-28 00:13:43 +08:00
Check out this [issue](https://github.com/ant-design-blazor/ant-design-blazor/issues/21) to learn about our development plans for 2020.
2020-03-14 15:19:36 +08:00
## 🤝 Contributing
2020-03-14 15:19:36 +08:00
2020-04-28 00:13:43 +08:00
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/ant-design-blazor/ant-design-blazor/pulls)
2020-03-14 15:19:36 +08:00
2020-04-28 00:13:43 +08:00
If you would like to contribute, feel free to create a [Pull Request](https://github.com/ant-design-blazor/ant-design-blazor/pulls), or give us [Bug Report](https://github.com/ant-design-blazor/ant-design-blazor/issues/new).
### Contributors
This project exists thanks to all the people who contribute.
2021-02-23 15:30:46 +08:00
<a href="https://github.com/ant-design-blazor/ant-design-blazor/graphs/contributors">
<img src="https://contrib.rocks/image?repo=ant-design-blazor/ant-design-blazor" />
</a>
2020-04-03 15:44:31 +08:00
## 💕 Donation
This project is an MIT-licensed open source project. In order to achieve better and sustainable development of the project, we expect to gain more backers. We will use the proceeds for community operations and promotion. You can support us in any of the following ways:
- [OpenCollective](https://opencollective.com/ant-design-blazor)
2021-02-23 15:30:46 +08:00
- [Wechat](https://jamesyeung.cn/qrcode/wepay.jpg)
- [Alipay](https://jamesyeung.cn/qrcode/alipay.jpg)
2020-04-03 15:44:31 +08:00
2020-04-28 00:13:43 +08:00
We will put the detailed donation records on the [backer list](https://github.com/ant-design-blazor/ant-design-blazor/issues/62).
2020-04-03 15:44:31 +08:00
## ❓ Community Support
2020-03-14 15:19:36 +08:00
If you encounter any problems in the process, feel free to ask for help via following channels. We also encourage experienced users to help newcomers.
2020-03-14 15:19:36 +08:00
2021-02-23 15:30:46 +08:00
- [![Discord Server](https://img.shields.io/discord/753358910341251182?color=%237289DA&label=AntBlazor&logo=discord&logoColor=white&style=flat-square)](https://discord.com/invite/jqu3Xeq)
- [![钉钉群](https://img.shields.io/badge/钉钉-AntBlazor-blue.svg?style=flat-square&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg0KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJpY29uIiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSIjZmZmZmZmIj4NCiAgPHBhdGggZD0iTTU3My43IDI1Mi41QzQyMi41IDE5Ny40IDIwMS4zIDk2LjcgMjAxLjMgOTYuN2MtMTUuNy00LjEtMTcuOSAxMS4xLTE3LjkgMTEuMS01IDYxLjEgMzMuNiAxNjAuNSA1My42IDE4Mi44IDE5LjkgMjIuMyAzMTkuMSAxMTMuNyAzMTkuMSAxMTMuN1MzMjYgMzU3LjkgMjcwLjUgMzQxLjljLTU1LjYtMTYtMzcuOSAxNy44LTM3LjkgMTcuOCAxMS40IDYxLjcgNjQuOSAxMzEuOCAxMDcuMiAxMzguNCA0Mi4yIDYuNiAyMjAuMSA0IDIyMC4xIDRzLTM1LjUgNC4xLTkzLjIgMTEuOWMtNDIuNyA1LjgtOTcgMTIuNS0xMTEuMSAxNy44LTMzLjEgMTIuNSAyNCA2Mi42IDI0IDYyLjYgODQuNyA3Ni44IDEyOS43IDUwLjUgMTI5LjcgNTAuNSAzMy4zLTEwLjcgNjEuNC0xOC41IDg1LjItMjQuMkw1NjUgNzQzLjFoODQuNkw2MDMgOTI4bDIwNS4zLTI3MS45SDcwMC44bDIyLjMtMzguN2MuMy41LjQuOC40LjhTNzk5LjggNDk2LjEgODI5IDQzMy44bC42LTFoLS4xYzUtMTAuOCA4LjYtMTkuNyAxMC0yNS44IDE3LTcxLjMtMTE0LjUtOTkuNC0yNjUuOC0xNTQuNXoiLz4NCjwvc3ZnPg0K)](https://h5.dingtalk.com/circle/healthCheckin.html?corpId=dingf3df1949a4aa48627b0128d9a44ecb79&c5df5865-4f41-=be1b34c7-397b-&cbdbhh=qwertyuiop&origin=11)
2020-03-14 15:19:36 +08:00
<details>
<summary>Scan QR Code with DingTalk</summary>
<img src="https://cdn.jsdelivr.net/gh/ant-design-blazor/ant-design-blazor/docs/assets/dingtalk.jpg" width="300">
</details>
## Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.
For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).
2020-03-14 15:19:36 +08:00
## ☀️ License
2020-03-14 15:19:36 +08:00
[![AntDesign](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](https://github.com/ant-design-blazor/ant-design-blazor/blob/master/LICENSE)
## .NET Foundation
This project is supported by the [.NET Foundation](https://dotnetfoundation.org).