--- title: Build a Blazor todo list app author: guardrex description: Build a Blazor app step-by-step. monikerRange: '>= aspnetcore-3.1' ms.author: riande ms.custom: mvc ms.date: 02/12/2021 no-loc: [Home, Privacy, Kestrel, appsettings.json, "ASP.NET Core Identity", cookie, Cookie, Blazor, "Blazor Server", "Blazor WebAssembly", "Identity", "Let's Encrypt", Razor, SignalR] uid: tutorials/build-a-blazor-app zone_pivot_groups: blazor-hosting-models --- # Build a Blazor todo list app ::: moniker range=">= aspnetcore-6.0" This tutorial shows you how to build and modify a Blazor app. You learn how to: > [!div class="checklist"] > * Create a todo list Blazor app project > * Modify Razor components > * Use event handling and data binding in components > * Use routing in a Blazor app At the end of this tutorial, you'll have a working todo list app. ## Prerequisites [!INCLUDE[](~/includes/6.0-SDK.md)] ## Create a Blazor app Create a new Blazor app named `TodoList` in a command shell: ::: zone pivot="server" ```dotnetcli dotnet new blazorserver -o TodoList ``` ::: zone-end ::: zone pivot="webassembly" ```dotnetcli dotnet new blazorwasm -o TodoList ``` ::: zone-end The preceding command creates a folder named `TodoList` with the `-o|--output` option to hold the app. The `TodoList` folder is the *root folder* of the project. Change directories to the `TodoList` folder with the following command: ```dotnetcli cd TodoList ``` ## Build a todo list Blazor app 1. Add a new `Todo` Razor component to the app using the following command: ```dotnetcli dotnet new razorcomponent -n Todo -o Pages ``` The `-n|--name` option in the preceding command specifies the name of the new Razor component. The new component is created in the project's `Pages` folder with the `-o|--output` option. > [!IMPORTANT] > Razor component file names require a capitalized first letter. Open the `Pages` folder and confirm that the `Todo` component file name starts with a capital letter `T`. The file name should be `Todo.razor`. 1. Open the `Todo` component in any file editor and add an `@page` Razor directive to the top of the file with a relative URL of `/todo`. `Pages/Todo.razor`: [!code-razor[](~/blazor/samples/6.0/BlazorSample_WebAssembly/Pages/build-a-blazor-app/Todo0.razor?highlight=1)] Save the `Pages/Todo.razor` file. 1. Add the `Todo` component to the navigation bar. The `NavMenu` component is used in the app's layout. Layouts are components that allow you to avoid duplication of content in an app. The `NavLink` component provides a cue in the app's UI when the component URL is loaded by the app. In the navigation element content (`