If the element triggers an action instead of a navigation — saves, deletes, opens a modal — take CdsButton. A button also accepts
hrefortowhen a navigation has to look like a button. The path through the hierarchy of sections is built by CdsBreadcrumbs, and sections of equal weight are switched by CdsTabs.
Variations
Link text
The text prop sets the label as a string, the default slot as arbitrary markup — text with an icon, for example. The slot wins over the prop.
Address
The href prop renders a regular link. Attributes are written on the component just like on an a tag: target="_blank" opens the page in a new tab — mark such a link with an icon so that leaving the application does not come as a surprise. Visited links change color; anchors like #section stay as they are.
Application route
The to prop accepts a path or a vue-router route object: the navigation runs without a page reload, and on the active route the link gets aria-current="page". The replace prop replaces the current history entry instead of adding a new one — so going "back" skips the intermediate screen. The exact prop treats the route as active only on a full match, not by prefix.
<CdsLink to="/profile" text="Профиль" />
<CdsLink :to="{ name: 'order', params: { id } }" exact text="Заказ" />
<CdsLink to="/login" replace text="Войти" />Disabled link
The disabled prop dims the color and removes the navigation: the component cancels the click, sets aria-disabled and takes the link out of the Tab order. Explain nearby why the navigation is unavailable — the gray state alone does not name the reason.
Guidelines
Scenarios
A link inside text
Inside a paragraph the link covers exactly the phrase that names the destination. A @click.prevent handler keeps the user on the page and reveals the details in place, while href="mailto:…" opens the mail client.
Result list
The titles of the found documents are links: the user scans the list and opens the one they need. The text comes from the text prop, and the click handler shows the selected document without leaving the page.
Documents with restricted access
The list shows all the documents of a procedure, but some of them are closed: disabled keeps their titles visible and blocks the navigation. The request access button lifts the restriction — the links come alive without reloading the list.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
content | string | number | undefined | — | Content displayed in the component. |
disabled | boolean | undefined | — | Disables the link: no navigation happens, aria-disabled and tabindex=-1 are set |
exact | boolean | undefined | — | If true, the active state applies only on an exact route match |
href | string | undefined | — | The href attribute of the link. When set, the component behaves as a regular link |
replace | boolean | undefined | — | If true, navigation replaces the current history entry instead of pushing a new one |
text | string | number | undefined | — | Text displayed in the component. |
theme | string | undefined | — | Component theme |
to | LinkTo | undefined | — | Target route or route location object for RouterLink. When set, the component behaves as a RouterLink |
Events
| Name | Type | Description |
|---|---|---|
click | [e: MouseEvent] | Click on the link |
Slots
| Name | Type | Description |
|---|---|---|
default | any | Link content. Takes precedence over the text prop. |