Table of Contents

Class KeyOptions

Namespace
MudBlazor.Services
Assembly
MudBlazor.dll

Configuration for preventDefault() and stopPropagation() control

For PreventDown, PreventUp, StopDown and StopUp the configuration which key combinations should match is a JavaScript boolean expression.

Examples: For the examples, let's assume the Tab key was pressed. Note: for combinations of more than one modifier the following order of modifiers must be followed strictly: shift+ctrl+alt+meta

* Don't prevent key down: PreventDown=null or PreventDown="none" * Prevent key down of unmodified keystrokes such as "Tab": PreventDown="key+none" * Prevent key down of Tab and Ctrl+Tab PreventDown="key+none|key+ctrl" * Prevent key down of just Ctrl+Tab PreventDown="key+ctrl" * Prevent key down of Ctrl+Tab and Shift+Tab but not Shift+Ctrl+Tab: PreventDown="key+shift|key+ctrl" * Prevent key down of Shift+Ctrl+Tab and Ctrl+Tab but not Shift+Tab: PreventDown="key+shift+ctrl|key+ctrl" * Prevent any combination of key and modifiers, but not the unmodified key: PreventDown="key+any" * Prevent any combination of key and modifiers, even the unmodified key: PreventDown="any"

public class KeyOptions
Inheritance
KeyOptions
Inherited Members
Extension Methods

Constructors

KeyOptions()

Initializes a new instance of the KeyOptions class.

public KeyOptions()

KeyOptions(string?, bool, bool, string, string, string, string)

Initializes a new instance of the KeyOptions class with specified parameters.

public KeyOptions(string? key, bool subscribeDown = false, bool subscribeUp = false, string preventDown = "none", string preventUp = "none", string stopDown = "none", string stopUp = "none")

Parameters

key string

The JavaScript keyboard event key.

subscribeDown bool

Whether to subscribe to key down events.

subscribeUp bool

Whether to subscribe to key up events.

preventDown string

Configuration for preventDefault() on key down events.

preventUp string

Configuration for preventDefault() on key up events.

stopDown string

Configuration for stopPropagation() on key down events.

stopUp string

Configuration for stopPropagation() on key up events.

Properties

Key

JavaScript keyboard event.key

Examples: " " for space, "Tab" for tab, "a" for lowercase A-key. Also allowed: JS regex such as "/[a-z]/" or "/a|b/" but NOT "/[a-z]/g" or "/[a-z]/i" regex must be enclosed in two forward slashes!

public string? Key { get; init; }

Property Value

string

PreventDown

Configuration for preventDefault() on key down events.

public string PreventDown { get; init; }

Property Value

string

PreventUp

Configuration for preventDefault() on key up events.

public string PreventUp { get; init; }

Property Value

string

StopDown

Configuration for stopPropagation() on key down events.

public string StopDown { get; init; }

Property Value

string

StopUp

Configuration for stopPropagation() on key up events.

public string StopUp { get; init; }

Property Value

string

SubscribeDown

Subscribe down key and invoke event KeyDown on C# side

public bool SubscribeDown { get; init; }

Property Value

bool

SubscribeUp

Subscribe up key and invoke event KeyUp on C# side

public bool SubscribeUp { get; init; }

Property Value

bool