Link
Token-styled link primitive with disabled and underline options.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.
tsximport { Link } from "@tavojs/ui/link";The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/link.
When to use
Use it when
Choose something else when
Examples
These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.
Link example
tsximport { Link } from "@tavojs/ui/link";
export function LinkExample1() {
return (
<>
<Link href="/docs">Read docs</Link>
<Link to="/docs">Read docs</Link>
</>
);
}Common props and defaults
A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
href | string | — | Configures href for this component. |
to | string | — | Configures to for this component. |
replace | boolean | — | Configures replace for this component. |
disabled | boolean | — | Configures disabled for this component. |
noUnderline | boolean | — | Configures noUnderline for this component. |
Complete TypeScript API
Import from @tavojs/ui/link. Published exports: Link, LinkProps.
LinkProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by Link. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Link. |
id | string | No | Inherited id attribute accepted by Link. |
role | string | No | Inherited role attribute accepted by Link. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Link. |
title | string | No | Inherited title attribute accepted by Link. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Link. |
hidden | boolean | No | Inherited hidden attribute accepted by Link. |
disabled | boolean | No | Configures disabled for this component. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Link. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Link. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Link. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Link. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Link. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Link. |
as | PolymorphicAs | No | Inherited as attribute accepted by Link. |
href | string | No | Configures href for this component. |
to | string | No | Configures to for this component. |
replace | boolean | No | Configures replace for this component. |
scroll | boolean | No | Inherited scroll attribute accepted by Link. |
noUnderline | boolean | No | Configures noUnderline for this component. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | No component state contract is exposed; the application owns the rendered content and surrounding behavior. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
This component exposes one public component root rather than a compound member API.
Limitations
Avoid Link when replacing interactive controls with content-only components.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Content components should keep meaningful text and media alternatives available to assistive technology.
Provide alt text for meaningful images.
Use semantic text variants for headings and paragraphs.
Do not hide essential content visually unless VisuallyHidden is intentional.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | content |
| Component import | @tavojs/ui/link |
| Explicit CSS import | @tavojs/ui/css/link |
| Preview | Interactive preview available on this page |