Link
Removed
The Link component was removed. A Button with an href is the link now. This page is kept so existing links resolve, and to record what maps to what.
What replaced it
Button takes an href, and renders as an <a class="tss-btn"> rather than a <button class="tss-btn"> when it has one. It is therefore middle-clickable, ctrl-clicks into a new tab and shows where it goes in the status bar, while looking exactly like any other button.
| Before | After |
|---|---|
Link(url, Button("Open").Primary()) |
Button("Open", href: url).Primary() |
Link(url, Button(...)).OpenInNewTab() |
Button(..., href: url).OpenInNewTab() |
Link(url, someComponent, noUnderline: true) |
Button(href: url).ReplaceContent(someComponent) |
Link(url, "text") |
Button("text", href: url) |
Link(url, "text", icon) |
Button("text", href: url).SetIcon(icon) |
Button("x").Link() / .DefaultLink() |
Button("x") |
Button("x").DangerLink() |
Button("x").Danger() |
link.OpenInNewTab() / link.URL / link.Target |
Button.OpenInNewTab() / Button.Href / set target yourself |
Link.AsWindow(features) |
none, call window.open from an OnClick |
Button.LinkOnHover() is unchanged, and IsLink still reports whether a button renders as a link.
What to check in your own code
Button.InnerElementis nowHTMLElement, notHTMLButtonElement. Anything that assigned it to anHTMLButtonElementor readbutton.InnerElement.disabledneeds adjusting; useIsEnabled/Disabled(bool), which were always class-based.- A stylesheet that matched buttons by element misses an href'd button. Search your CSS for selectors like
.my-toolbar > buttonand match.tss-btninstead. A sibling rule using:first-of-typeshould become:first-child, sinceof-typecompares element kinds and a mixed row of<a>and<button>breaks it.
Usage
See also
- Button — the component that replaced this one.
- Inline Label — a small fact that can also be a real link.
- ActionButton