RouteLink

in namespace DotVVM.Controls.Tailwind.Controls

Renders a styled anchor link that navigates to a route, with the same visual design as Button.

Usage & Scenarios

Renders a Tailwind-styled route link that shares the same visual API as the Tailwind Button. Use the built-in route properties such as RouteName and Param-*, together with Tailwind-specific Type, Size, Icon, and IconPosition.

Sample 1: Button-Like Route Links

The Tailwind RouteLink supports the same Type, Size, Icon, IconPosition, and template content combinations as the Tailwind Button, while still navigating through the DotVVM route table.

@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Main">
    <div class="flex flex-wrap gap-2 items-center">
        <t:RouteLink Type="Default" Text="Default" RouteName="SampleB" />
        <t:RouteLink Type="Primary" Text="Primary" RouteName="SampleB" />
        <t:RouteLink Type="Success" Text="Icon + text" Icon="Check" RouteName="SampleB" />
        <t:RouteLink Type="Secondary" Icon="Plus" RouteName="SampleB" />
        <t:RouteLink Type="Primary" Text="Large" Size="Large" RouteName="SampleB" />
        <t:RouteLink Type="Primary" Text="Next" Icon="ArrowRight" IconPosition="End" RouteName="SampleB" />
        <t:RouteLink Type="Ghost" RouteName="SampleA">
            <strong>Content only</strong>
        </t:RouteLink>
    </div>

    <p>Current page: Sample A</p>
</dot:Content>
@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Main">
    <t:RouteLink Type="Primary" Text="Back to Sample A" RouteName="SampleA" Icon="ArrowLeft" />

    <p>Current page: Sample B</p>
</dot:Content>
<dot:ContentPlaceHolder ID="Main" />
using DotVVM.Framework.Configuration;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.RouteLink.sample1
{
    public class Startup : IDotvvmStartup
    {
        public void Configure(DotvvmConfiguration config, string applicationPath)
        {
            config.RouteTable.Add("SampleA", "", "SampleA.dothtml", null);
            config.RouteTable.Add("SampleB", "target", "SampleB.dothtml", null);
        }
    }
}

Sample 2: Route Parameters

Use the built-in route-link properties such as RouteName and Param-* to navigate to routes with parameters. The target page reads the parameter value from Context.Parameters.

@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Main">
    <div class="flex flex-wrap gap-2 items-center">
        <t:RouteLink Type="Primary" Text="Open detail 42" RouteName="SampleB" Param-Id="42" />
        <t:RouteLink Type="Secondary" Text="Open detail 99" RouteName="SampleB" Param-Id="99" Icon="DocumentText" />
    </div>

    <p>Current page: Sample A</p>
</dot:Content>
@masterPage master.dotmaster

<dot:Content ContentPlaceHolderID="Main">
    <p>Current route parameter: {{value: RouteId}}</p>

    <t:RouteLink Type="Primary" Text="Back to Sample A" RouteName="SampleA" />
</dot:Content>
<dot:ContentPlaceHolder ID="Main" />
using System;
using System.Threading.Tasks;
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.RouteLink.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public string RouteId { get; set; } = "(none)";

        public override Task Init()
        {
            if (Context.Parameters.ContainsKey("Id"))
            {
                RouteId = Convert.ToString(Context.Parameters["Id"]);
            }

            return base.Init();
        }
    }
}
using DotVVM.Framework.Configuration;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.RouteLink.sample2
{
    public class Startup : IDotvvmStartup
    {
        public void Configure(DotvvmConfiguration config, string applicationPath)
        {
            config.RouteTable.Add("SampleA", "", "SampleA.dothtml", null);
            config.RouteTable.Add("SampleB", "detail/{Id?}", "SampleB.dothtml", null);
        }
    }
}

Properties

Name Type Description Notes Default Value
property icon Culture String Gets or sets the culture segment used when generating the route URL.
attribute
inner element
static value
bindable
default
null
property icon Enabled Boolean Gets or sets whether the route link is enabled and can be clicked.
attribute
inner element
static value
bindable
default
True
property icon Icon HeroIcon
attribute
inner element
static value
bindable
default
null
property icon IconPosition IconPosition
attribute
inner element
static value
bindable
default
Start
property icon RouteName String Gets or sets the DotVVM route name this link navigates to.
attribute
inner element
static value
bindable
default
null
property icon Size ControlSize
attribute
inner element
static value
bindable
default
Default
property icon Template ITemplate Gets or sets custom content rendered inside the route link instead of plain text.
attribute
inner element
static value
bindable
default
null
property icon Text String Gets or sets the plain text label rendered inside the route link.
attribute
inner element
static value
bindable
default
null
property icon Type ButtonType
attribute
inner element
static value
bindable
default
Default
property icon UrlSuffix String Gets or sets the URL suffix appended after the generated route URL.
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control.
attribute
inner element
static value
bindable
default
True

HTML produced by the control