Tabbed Navigation
Links to other pages, displayed as tabs
<sa-tab-nav>
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#">Car Rental</sa-tab-nav-link>
</sa-tab-nav>Usage
Use <sa-tab-nav> with <sa-tab-nav-link> to implement a tabbed navigation pattern where each tab navigates the user to a different url. It renders plain links and needs no JavaScript. For interactive tabs that changes content as the user clicks on them, use Tabs instead.
<sa-tab-nav>
<sa-tab-nav-link>...</sa-tab-nav-link>
</sa-tab-nav>Examples
Variant
Create underline tabs by setting the variant attribute.
<sa-tab-nav variant="TabNavVariant.Line">
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#">Car Rental</sa-tab-nav-link>
</sa-tab-nav>Orientation
Create vertical tabs by setting the orientation attribute.
<sa-tab-nav orientation="TabNavOrientation.Vertical" class="w-fit">
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#">Car Rental</sa-tab-nav-link>
</sa-tab-nav>Icons
Use icons along with the text.
<sa-tab-nav>
<sa-tab-nav-link href="#">
<sa-icon name="plane"/>
Flights
</sa-tab-nav-link>
<sa-tab-nav-link href="#">
<sa-icon name="bed-double"/>
Accommodation
</sa-tab-nav-link>
<sa-tab-nav-link href="#">
<sa-icon name="car-front"/>
Car Rental
</sa-tab-nav-link>
</sa-tab-nav>Icons only
Tabs can contain only an icon. Give each one an accessible name.
<sa-tab-nav>
<sa-tab-nav-link href="#">
<sa-icon name="plane"/>
</sa-tab-nav-link>
<sa-tab-nav-link href="#">
<sa-icon name="bed-double"/>
</sa-tab-nav-link>
<sa-tab-nav-link href="#">
<sa-icon name="car-front"/>
</sa-tab-nav-link>
</sa-tab-nav>Active item
Set the currently active item using the active attribute.
<sa-tab-nav>
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link active="true" href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#">Car Rental</sa-tab-nav-link>
</sa-tab-nav>URL
The URL of <sa-tab-nav-link> can be specified a couple of ways:
- You can use the
hrefproperty to specify any valid URL as per thehrefproperty of the anchor element. - You can use any of the attributes that are valid for specifying the URL for the ASP.NET Core Anchor Tag Helper, such as
asp-controller,asp-action,asp-page, etc. Please refer to the Anchor Tag Helper documentation for more examples.
<sa-tab-nav>
<sa-tab-nav-link asp-controller="Search" asp-route-category="flights">
Flights
</sa-tab-nav-link>
<sa-tab-nav-link asp-controller="Search" asp-route-category="accommodation">
Accommodation
</sa-tab-nav-link>
<sa-tab-nav-link asp-controller="Search" asp-route-category="carrental">
Car Rental
</sa-tab-nav-link>
</sa-tab-nav>When specifying the URL, StellarAdmin will automatically set the active attribute for the link representing the currently active route, so you should not need to specify the active attribute explicitly. However, StellarAdmin can not always determine this correctly - especially if the URL contains query string parameters. In such cases, you can explicitly set the active attribute to either true or false.
Disabled
Disable a tab using the disabled attribute.
<sa-tab-nav>
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#" disabled="true">Car Rental</sa-tab-nav-link>
</sa-tab-nav>Overflow
When a horizontal tab list is wider than the space it has, the tabs keep their width and the list scrolls sideways.
<div class="w-full max-w-sm">
<sa-tab-nav variant="TabNavVariant.Line">
<sa-tab-nav-link href="#">Flights</sa-tab-nav-link>
<sa-tab-nav-link href="#">Accommodation</sa-tab-nav-link>
<sa-tab-nav-link href="#">Car Rental</sa-tab-nav-link>
<sa-tab-nav-link href="#">Excursions</sa-tab-nav-link>
<sa-tab-nav-link active="true" href="#">Travel Insurance</sa-tab-nav-link>
<sa-tab-nav-link href="#">Transfers</sa-tab-nav-link>
</sa-tab-nav>
</div>Accessibility
<sa-tab-nav> renders a <nav> element of links, and the current link has aria-current="page". Users move between the links with the Tab key, like any other links. Give the navigation an accessible name with aria-label or aria-labelledby. A disabled link has its href removed and aria-disabled="true", so it can't be followed.
API Reference
<sa-tab-nav>
Renders a <nav> element, which takes the attributes you give it, such as id, class and aria-label.
Prop
Type
<sa-tab-nav-link>
Renders an <a> element.
Prop
Type
Routing attributes
The link also accepts the same routing attributes as the ASP.NET Core Anchor Tag Helper for generating the href. Supply either an href or these attributes — not both.
Prop
Type