Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • DrawerNew
  • Footer
  • MenuNew
  • Navbar
  • On This PageNew
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • TextNew
  • Link
  • Button
  • FormNew
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • NumericNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Textfield
    • Time Picker
    • Time Range Picker
  • Alert
  • Avatar
  • Chip
  • Icon
  • PopoverNew
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • Pagination
  • Pick List
  • BarcodeNew
  • QR CodeNew
  • CalendarNew
  • Table
  • AttachmentNew
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Typography

TwLink

TwLink renders an accessible anchor that follows the theme's primary colour by default, with optional semantic colours, neutral tones and typography sizes.

Last updated 26 October 2026

Basic usage

Set Href and put the link text in ChildContent. With no custom class, a link uses the theme's primary text colour and the default underline treatment from TwLinkTheme.

Read the twblazor documentation for guides and examples.

RAZOR
<p class="text-sm">
    Read the <TwLink Href="https://twblazor.com" Color="Color.Primary" Class="underline">twblazor documentation</TwLink> for guides and examples.
</p>

Colour and tone

Set Color for a semantic theme colour, or Tone for a neutral text token. An explicit colour or tone is applied even when you also set a custom class.
Primary link Danger link Secondary neutral link Muted neutral link Inherits the surrounding colour
RAZOR
<TwFlex Direction="FlexDirection.Col" Gap="1">
    <TwLink Href="#">Primary link</TwLink>
    <TwLink Href="#" Color="Color.Danger">Danger link</TwLink>
    <TwLink Href="#" Tone="TextTone.Secondary">Secondary neutral link</TwLink>
    <TwLink Href="#" Tone="TextTone.Muted">Muted neutral link</TwLink>
    <TwLink Href="#" Tone="TextTone.Inherit" Class="text-sm">Inherits the surrounding colour</TwLink>
</TwFlex>

Size, weight and truncation

Size and Weight use the shared typography scales. Truncate cuts overflowing link text with an ellipsis.
Large semibold link Small secondary link A long link label that is truncated when it no longer fits
RAZOR
<TwFlex Direction="FlexDirection.Col" Gap="1">
    <TwLink Href="#" Size="TextSize.Lg" Weight="TextWeight.Semibold">Large semibold link</TwLink>
    <TwLink Href="#" Size="TextSize.Sm" Tone="TextTone.Secondary">Small secondary link</TwLink>
    <TwLink Href="#" Truncate Class="block max-w-48">A long link label that is truncated when it no longer fits</TwLink>
</TwFlex>

Opening a new tab

Set Target="_blank" to open a link in a new tab. The component adds rel="noopener" and tells assistive technology that the link opens a new tab. Set Rel yourself to override the default.
Open the twblazor repository(opens in new tab)
RAZOR
<TwLink Href="https://github.com/twblazor/twblazor" Target="_blank">Open the twblazor repository</TwLink>

Custom styling

A custom Class replaces the default link treatment, which is useful inside a button or a card. The focus ring is kept so keyboard users can still see where they are; set Color to keep a theme colour alongside your own classes.
A custom-styled link
RAZOR
<TwLink Href="https://twblazor.com" Color="Color.Primary" Class="font-semibold underline underline-offset-4">
    A custom-styled link
</TwLink>

Keyboard navigation

A link is a native anchor, so it is one Tab stop and follows its Href with Enter. A link that opens a new tab says so to screen readers.
Key What it does
Tab or Shift+ plus Tab Moves focus to the link.
Enter Follows the link.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwLinkTheme), configured via the AddTwBlazor() options callback described on the Get Started page. Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Property Type Controls
Default string

Full reference: TwLinkTheme on the API docs.

On this page

  • Basic usage
  • Colour and tone
  • Size, weight and truncation
  • Opening a new tab
  • Custom styling
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload