Table of Contents

Class DeviceDetector

Namespace
TwBlazor.Utilities
Assembly
TwBlazor.dll

Detects whether the current client platform should use its own native input UI (e.g. the iOS/Android date, time, and color pickers) instead of a TwBlazor picker's custom popover.

public static class DeviceDetector
Inheritance
DeviceDetector
Inherited Members

Methods

PrefersNativePickerAsync(IJSRuntime, CancellationToken)

Asks the browser, via JS interop, whether the current device is a mobile platform (iOS or Android) that provides its own native picker UI.

public static Task<bool> PrefersNativePickerAsync(IJSRuntime jsRuntime, CancellationToken cancellationToken = default)

Parameters

jsRuntime IJSRuntime

The JS runtime used to query the client platform.

cancellationToken CancellationToken

A token used to cancel the interop call.

Returns

Task<bool>

true if the client is running iOS or Android; otherwise false. Also returns false if the JS runtime is unavailable (e.g. during prerendering or in unit tests), so callers safely fall back to the custom picker UI.