Skip to content

HyperlinkExtensions

Namespace: Hex1b

Assembly: Hex1b.dll

Extension methods for creating and configuring instances using the fluent API.

csharp
public static class HyperlinkExtensions

Inheritance

ObjectHyperlinkExtensions

Methods

Ellipsis(HyperlinkWidget)

Sets the text overflow behavior to . Text is truncated with "..." when it exceeds the available width.

Parameters:

Returns: HyperlinkWidget

A new with Ellipsis overflow behavior.

csharp
public static HyperlinkWidget Ellipsis(this HyperlinkWidget widget)

Creates a with the specified text, URI, and click handler.

Parameters:

  • ctx (WidgetContext<<TParent>>): The widget context.
  • text (String): The visible text to display.
  • uri (String): The URI to link to when clicked.
  • onClick (Action<HyperlinkClickedEventArgs>): The click handler to invoke when the hyperlink is activated.

Returns: HyperlinkWidget

A new configured with the click handler.

csharp
public static HyperlinkWidget Hyperlink<TParent>(this WidgetContext<TParent> ctx, string text, string uri, Action<HyperlinkClickedEventArgs> onClick) where TParent : Hex1bWidget

Creates a with the specified text, URI, and async click handler.

Parameters:

  • ctx (WidgetContext<<TParent>>): The widget context.
  • text (String): The visible text to display.
  • uri (String): The URI to link to when clicked.
  • onClick (Func<HyperlinkClickedEventArgs, Task>): The async click handler to invoke when the hyperlink is activated.

Returns: HyperlinkWidget

A new configured with the async click handler.

csharp
public static HyperlinkWidget Hyperlink<TParent>(this WidgetContext<TParent> ctx, string text, string uri, Func<HyperlinkClickedEventArgs, Task> onClick) where TParent : Hex1bWidget

Creates a with the specified text and URI.

Parameters:

  • ctx (WidgetContext<<TParent>>): The widget context.
  • text (String): The visible text to display.
  • uri (String): The URI to link to when clicked.

Returns: HyperlinkWidget

A new with default overflow behavior (Truncate).

csharp
public static HyperlinkWidget Hyperlink<TParent>(this WidgetContext<TParent> ctx, string text, string uri) where TParent : Hex1bWidget

Truncate(HyperlinkWidget)

Sets the text overflow behavior to . Text is clipped by parent containers with no visual indicator.

Parameters:

Returns: HyperlinkWidget

A new with Truncate overflow behavior.

csharp
public static HyperlinkWidget Truncate(this HyperlinkWidget widget)

Wrap(HyperlinkWidget)

Sets the text overflow behavior to . Text wraps to multiple lines at word boundaries.

Parameters:

Returns: HyperlinkWidget

A new with Wrap overflow behavior.

csharp
public static HyperlinkWidget Wrap(this HyperlinkWidget widget)

Remarks

These methods enable concise hyperlink widget creation within widget builder callbacks. The returned can be further configured with overflow methods like and , click handlers, or size hints.

Examples

Using Hyperlink within a VStack:

csharp
ctx.VStack(v => [
    v.Hyperlink("Click here", "https://example.com"),
    v.Hyperlink("Long link text that wraps", "https://example.com").Wrap()
])

Released under the MIT License.