Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

AppTitle

Since 0.1.0-alpha.32
Gives each page's title the app's name, as in Deals · Izzy CRM.

Use it in place of PageTitle on every page, so a browser tab, a bookmark and what a screen reader says when the page opens all name the app as well as the page.

A page's title

Set the app's name once in Program.cs, with AddIzzyBlazor(o => o.AppName = "Izzy CRM") (and AddIzzyBlazorCore in a .Client project). Then each page writes its own title inside AppTitle, and the name follows it.

Static

Preview

Code

Usage.razor
@inject IzzyBlazorOptions Options

@* A CRM's list of deals. AppTitle gives this window's title the app's name, which Program.cs sets once:
   here it's this site's, IzzyBlazor. The line under the header shows the title it wrote. *@
<AppTitle>Deals</AppTitle>
<Stack Gap="4" Padding="4">
    <PageHeader Title="Deals" Description="12 open, worth $84,200." />
    <TextBlock Size="TextSize.Sm" Color="Color.Muted">This window's title: @Options.Title("Deals")</TextBlock>
</Stack>

Add this example to a page with the izzy CLI:

bash
izzy add component AppTitle --at <file>:<line>

TitleFormat joins the two, "{0} · {1}" by default, where {0} is the page's title and {1} the name. To leave the name out of every title, set AppNameInTitle to false; for one page, set ShowAppName to false.

A home page writes <AppTitle /> for the name alone. It keeps the name with the name turned off, so the page always has a title.

For a tag that wants the same words, such as og:title, inject IzzyBlazorOptions and call Title("Deals").

Details

The name is the app's AppName, set once in Program.cs (AddIzzyBlazor(o => o.AppName = "Izzy CRM"), and AddIzzyBlazorCore in a .Client project). TitleFormat joins the two ("{0} · {1}" by default), and AppNameInTitle false leaves the name out of every title. With no AppName it writes the page's title alone. <AppTitle /> with nothing inside, as a home page has, writes the name alone, whatever the switches say, so the page is never untitled. ShowAppName false leaves the name out of one page's title.

Mode support

What works in each mode, AppTitle
FeatureStaticInteractive
EverythingYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Accessibility

  • Screen readers read the title when a page opens, so the name tells people which app they're in as well as which page (WCAG 2.4.2, Page Titled).
  • Put what's on the page first and the app's name after, as the default format does, so each tab and each title read out starts with what tells pages apart.

Parameters

AppTitle parameters
PropTypeDefault
ChildContentThe page's own title, such as Deals or @deal.Name.RenderFragment?
ShowAppNameWhether this page's title has the app's name.booltrue

See also

  • AppShell: arranges a header, sidebar, main area, aside and footer with CSS.
  • AppBrand: the app or site name in an AppHeader (or a sidebar's header), with an icon or logo before it, usually linking home.

Connection lost

Rejoining the server…