HyperlinkWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A widget that renders text as a clickable hyperlink using OSC 8 escape sequences. In terminals that support OSC 8 (most modern terminals), the text will be rendered as a clickable link. In unsupported terminals, the text will be rendered normally.
public sealed record HyperlinkWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<HyperlinkWidget>Inheritance
Object → Hex1bWidget → HyperlinkWidget
Implements
Constructors
HyperlinkWidget(string, string, TextOverflow)
A widget that renders text as a clickable hyperlink using OSC 8 escape sequences. In terminals that support OSC 8 (most modern terminals), the text will be rendered as a clickable link. In unsupported terminals, the text will be rendered normally.
Parameters:
Text(String): The visible text to display.Uri(String): The URI to link to when clicked (or hovered in terminal).Overflow(TextOverflow): How to handle text that exceeds the available width.
public HyperlinkWidget(string Text, string Uri, TextOverflow Overflow = TextOverflow.Truncate)Properties
Overflow
How to handle text that exceeds the available width.
Returns: TextOverflow
public TextOverflow Overflow { get; init; }Parameters
Optional parameters for the hyperlink (e.g., "id=unique-id"). Per the OSC 8 spec, the id parameter can be used to group multiple hyperlink segments that should be treated as a single logical link.
Returns: String
public string Parameters { get; init; }Text
The visible text to display.
Returns: String
public string Text { get; init; }Uri
The URI to link to when clicked (or hovered in terminal).
Returns: String
public string Uri { get; init; }Methods
OnClick(Action<HyperlinkClickedEventArgs>)
Sets a synchronous click handler. Called when the hyperlink is activated via Enter or mouse click.
Parameters:
handler(Action<HyperlinkClickedEventArgs>):
Returns: HyperlinkWidget
public HyperlinkWidget OnClick(Action<HyperlinkClickedEventArgs> handler)OnClick(Func<HyperlinkClickedEventArgs, Task>)
Sets an asynchronous click handler. Called when the hyperlink is activated via Enter or mouse click.
Parameters:
handler(Func<HyperlinkClickedEventArgs, Task>):
Returns: HyperlinkWidget
public HyperlinkWidget OnClick(Func<HyperlinkClickedEventArgs, Task> handler)WithId(string)
Sets a unique ID parameter for the hyperlink. This is useful for grouping multiple hyperlink segments together.
Parameters:
id(String):
Returns: HyperlinkWidget
public HyperlinkWidget WithId(string id)WithParameters(string)
Sets the optional parameters for the hyperlink.
Parameters:
parameters(String):
Returns: HyperlinkWidget
public HyperlinkWidget WithParameters(string parameters)Fields
ActivateActionId
Action ID for activating the hyperlink.
Returns: ActionId
public static readonly ActionId ActivateActionId