Skip to content
Shiny PlatformShiny Platform
.NET MAUI on the WebRun your MAUI app in the browser on WebAssembly - real DOM elements, no Blazor. Try the web sample and the .NET MAUI GalleryGet started

NotchView

A Dynamic Island style surface that holds anything and morphs its width, height and corner radius to fit it. There are no compact or expanded states to manage. Put a view inside it and the notch sizes itself to that view. Swap the content, or let the content change its own size, and it springs to the new size.

  • NuGet downloads for Shiny.Maui.Controls
  • NuGet downloads for Shiny.Blazor.Controls
  • NuGet downloads for Shiny.Maui.Controls.Desktop (for the desktop window over every app: Windows, Linux, macOS)
Frameworks
.NET MAUI
Blazor
  • Sizes to its content: content plus padding, clamped between a minimum and a maximum, with the parent’s width as a cap so wide content wraps
  • Follows the content: a content swap, or content that grows or shrinks on its own, springs the notch to the new size, with no call needed
  • The content is laid out once at its final size and the surface clips it while it animates, so text never re-wraps mid-morph
  • The content is pinned to the top of the surface, which grows and shrinks from its top edge, so a header or tab strip along the top stays still while the bottom is revealed or clipped
  • Wrapping text inside content with a fixed WidthRequest is measured at that width, so every line fits
  • New content fades in on a swap
  • Island (every corner rounded) or Notch (square top corners, flush with the top edge) shapes
  • Blazor: overlays the very top of the screen by default, in the browser’s top layer, above everything on the page; Inline lays it out in the page flow instead
  • Automatic corners: a full pill while short, capped at 28 as it grows tall, so it never turns into an oval
  • Tap/click events, a NotchSizeChanged event when a morph starts, and MorphCompleted on MAUI
  • Blazor honours prefers-reduced-motion
  • Desktop: the Desktop add-on puts the notch in a window above every other app on Windows, Linux and macOS: in the MacBook camera notch, or as an island floating at the top of the screen
<Grid>
<ScrollView>
<VerticalStackLayout Padding="16,120,16,16">
<!-- page content -->
</VerticalStackLayout>
</ScrollView>
<!-- same Grid cell, so it floats over the page, top-centre by default -->
<shiny:NotchView x:Name="Notch" Margin="0,12,0,0" Tapped="OnNotchTapped">
<HorizontalStackLayout Spacing="8">
<Ellipse Fill="Red" WidthRequest="10" HeightRequest="10" VerticalOptions="Center" />
<Label Text="0:42" TextColor="White" FontAttributes="Bold" />
</HorizontalStackLayout>
</shiny:NotchView>
</Grid>
Notch.Content = new NowPlayingView(); // grows to fit; the new content fades in
Notch.Content = null; // back to MinNotchWidth x MinNotchHeight
<NotchView ContentKey="@state" OnClick="Toggle" OnNotchSizeChanged="s => size = s">
@switch (state)
{
case "recording":
<span style="font-weight:700">● 0:42</span>
break;
case "playing":
<NowPlaying />
break;
}
</NotchView>

Change ContentKey when you switch to different content, and the new content fades in. Content that only changes size needs no key; a ResizeObserver follows it.

The notch overlays the very top of the screen wherever the component sits: it opens as a manual popover, so it lives in the browser’s top layer, flush with the top edge of the viewport and centred, above the page, its scroll and any parent’s overflow, transform or z-index. An Island floats 8px below the edge (plus the safe-area inset), and --shiny-notch-offset moves either shape down. Set Inline="true" to put it back in the page flow, centred in its parent, for a notch inside a card or a device mock-up.

Property Type (MAUI / Blazor) Default Description
Content / ChildContent View / RenderFragment null Anything. The notch sizes itself to it
ContentKey — / object null Blazor: change it on a content swap to fade the new content in
Inline bool (Blazor) false false overlays the top of the screen; true lays it out in the page flow
Shape NotchShape Island (MAUI) / Notch (Blazor) Island or Notch (square top corners)
SurfaceColor Color / string Black The fill, black on every theme. Give the content light text. Blazor: --shiny-notch-surface
Stroke / StrokeThickness Color / string, double none Optional outline
ContentPadding Thickness / string 14,8 / 8px 14px Space between the edge and the content
MinNotchWidth / MinNotchHeight double 120 / 36 The smallest size, and the size with no content
MaxNotchWidth / MaxNotchHeight double unbounded Caps. The parent’s width is also a cap
CornerRadius double -1 -1 = automatic pill, capped at 28. Clamped to half the height
MorphDuration ms 420 0 snaps
MorphEasing Easing (MAUI) soft spring Blazor uses a matching cubic-bezier
HasShadow bool true Soft drop shadow
Command / CommandParameter MAUI null Run on a tap of the surface
NotchSize / Size read-only The size it is at, or morphing towards

Events: Tapped, NotchSizeChanged, MorphCompleted (MAUI); OnClick, OnNotchSizeChanged (Blazor). On Blazor, clicks inside the content bubble up to OnClick, so give inner buttons @onclick:stopPropagation when they should not count as a click on the notch.

Shiny.Maui.Controls.Desktop puts a NotchView in a borderless window at the top-centre of the screen, above every other app, on macOS, Windows and Linux. It works like the quick entry popup: an OS window, not something drawn inside your app, so it stays on screen while the user works in other apps.

  • On a MacBook it lives in the hardware camera notch. The empty notch is exactly the size of the cut-out, so it disappears into it. Give it content and it grows down out of the notch, with the content padded below the camera housing.
  • Everywhere else (a Mac display without a notch, every Windows and Linux screen) it floats as an island centred at the top of the screen, TopMargin below the menu bar, a top-docked taskbar or a top panel. Set TopMargin = 0 and Shape = NotchShape.Notch for a notch that hangs from the top edge.
Recording Now playing Message
A black notch grown down out of the MacBook camera notch showing a red dot and a 0:42 recording timer The camera notch grown wider and taller to fit a now-playing card with artwork, track title, artist and a progress bar The camera notch sized to a message with a sender name and three lines of wrapped text
#if !ANDROID && !IOS && !MACCATALYST
builder
.UseShinyControls()
.UseShinyDesktop(cfg => cfg.ConfigureNotch(o =>
{
o.MaxWidth = 520;
o.Configure = notch => notch.SurfaceColor = Colors.Black;
}));
// INotchWindowService, injected
await notchWindow.ShowAsync(new Label { Text = "Recording 0:42", TextColor = Colors.White });
await notchWindow.SetContentAsync(new NowPlayingView()); // grows to fit
await notchWindow.SetContentAsync(null); // back to the empty notch
notchWindow.Hide();
// expand on hover, whether or not your app is active
notchWindow.PointerEntered += (_, _) => Expand();
notchWindow.PointerExited += (_, _) => Collapse();
#endif
NotchWindowOptions Default
UseHardwareNotch true Hug the camera notch when the screen has one (macOS)
TopMargin 8 Gap between the top of the usable screen area and the floating island
MaxWidth / MaxHeight 640 / 480 Caps, in points
MorphDuration 300 Window reshape time, ms. 0 snaps
JoinAllSpaces true Every Space and over full-screen apps (macOS); every workspace (Linux X11); ignored on Windows
Configure null Styles each NotchView the service creates. Runs last, so it wins

INotchWindowService is the primary display’s notch. To show a notch on other displays, or on several at once, inject INotchWindowFactory, which UseShinyDesktop() also registers. GetDisplays() lists the displays, the primary first, and Create(displayId) makes a notch on one of them.

#if !ANDROID && !IOS && !MACCATALYST
// INotchWindowFactory, injected (UseShinyDesktop registers it next to INotchWindowService)
foreach (var display in factory.GetDisplays()) // the primary first
{
// display.Id survives relaunches: save it to remember the user's choice
var notch = factory.Create(display.Id); // you own it: Dispose() closes its window
await notch.ShowAsync(new Label { Text = display.Name, TextColor = Colors.White });
}
#endif
NotchDisplay
Id Survives relaunches, for saving the user’s choice: vendor, model and serial number on macOS, the device name on Windows, the connector on Linux
Name What to call the display in a list (“Built-in Retina Display”, “DELL U2720Q”)
IsPrimary The display with the menu bar (macOS), or the main display
HardwareNotchSize This display’s camera cut-out; Size.Zero without one

Each notch works out its own display’s geometry, so with a MacBook open beside an external monitor the built-in display’s notch grows out of the camera and the monitor’s has no cut-out. You own a notch from Create: dispose it when its display goes, which closes its window. An id that isn’t connected falls back to the primary display.

macOS Windows Linux (X11) Linux (Wayland)
Position Camera notch, or under the menu bar, on the display asked for Top-centre of the monitor asked for (the primary by default) Top-centre of the monitor asked for (the primary by default) Chosen by the compositor
Above other apps Yes Yes Yes No
In the taskbar / app switcher No No No Compositor’s choice
Morph Native window animation Window resized every frame Window resized every frame Window resized every frame
Content swap Old content collapses with the window and fades out; new content fades in New content fades in New content fades in New content fades in
Edges Antialiased Aliased (window region) Antialiased (needs a compositor) Antialiased