FieldAdornment
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Describes an adornment to display next to a form field. The adornment's visibility is controlled by an async predicate evaluated against the field value. When the predicate resolves to true, the widget returned by the builder is rendered.
public sealed record FieldAdornment : IEquatable<FieldAdornment>Inheritance
Object → FieldAdornment
Implements
Constructors
FieldAdornment(Func<string, CancellationToken, Task<bool>>, Func<Hex1bWidget>)
Describes an adornment to display next to a form field. The adornment's visibility is controlled by an async predicate evaluated against the field value. When the predicate resolves to true, the widget returned by the builder is rendered.
Parameters:
Predicate(Func<String, CancellationToken, Boolean>>): Async function that receives the current field value and a cancellation token. Returns true if the adornment should be visible.Builder(Func<Hex1bWidget>): Factory function that creates the widget to display when the adornment is visible. Called during reconciliation when the predicate has resolved to true.
public FieldAdornment(Func<string, CancellationToken, Task<bool>> Predicate, Func<Hex1bWidget> Builder)Properties
Builder
Factory function that creates the widget to display when the adornment is visible. Called during reconciliation when the predicate has resolved to true.
Returns: Func<Hex1bWidget>
public Func<Hex1bWidget> Builder { get; init; }Predicate
Async function that receives the current field value and a cancellation token. Returns true if the adornment should be visible.
Returns: Func<String, CancellationToken, Boolean>>
public Func<string, CancellationToken, Task<bool>> Predicate { get; init; }Methods
Create(Func<string, Task<bool>>, Func<Hex1bWidget>)
Creates an adornment with a predicate that doesn't need cancellation support.
Parameters:
predicate(Func<String, Boolean>>):builder(Func<Hex1bWidget>):
Returns: FieldAdornment
public static FieldAdornment Create(Func<string, Task<bool>> predicate, Func<Hex1bWidget> builder)