# Link

Source: https://ecosphere.dev/docs/actions/link (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

Inline text links: plain, underlined, and with a trailing arrow.

`import { EcoLink } from "vue-ecosphere"`

## With arrow

For “see more” exits at the end of a card or section.

Vue (vue-ecosphere):

```vue
<EcoLink href="#" arrow>View all</EcoLink>
```

React (react-ecosphere):

```tsx
<EcoLink href="#" arrow>View all</EcoLink>
```

## Button link

An action that changes the page, not the location, is a button styled as a link.

Vue (vue-ecosphere):

```vue
<EcoLink @click="markAllRead">Mark all as read</EcoLink>
```

React (react-ecosphere):

```tsx
<EcoLink onClick={markAllRead}>Mark all as read</EcoLink>
```

## Underlined

Inside running text, where colour alone should not carry the link.

Vue (vue-ecosphere):

```vue
<EcoLink underline>See plans</EcoLink>
```

React (react-ecosphere):

```tsx
<EcoLink underline>See plans</EcoLink>
```

## Through the router

With vue-router installed, `to` renders an anchor with the resolved href and navigates without a page load.

Vue (vue-ecosphere):

```vue
<EcoLink to="/docs/actions/button" arrow>See buttons</EcoLink>
```

React (react-ecosphere):

```tsx
<EcoLink as={Link} to="/docs/actions/button" arrow>See buttons</EcoLink>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` | — | Render an anchor. Without it the link is a button for an in-page action. |
| `to` | `string \| RouteLocationRaw` | — | Navigate through vue-router's RouterLink (an anchor with the resolved href) when the app has it installed; a string falls back to a plain link. |
| `label` | `string` | — | Text when you don't use the default slot. |
| `arrow` | `boolean` | false | Trailing arrow that nudges on hover. |
| `underline` | `boolean` | false | Underlined (link--ul). |
| `type` | `"button" \| "submit" \| "reset"` | "button" | Native type when rendered as a button. |
| `disabled` | `boolean` | false | Disabled button, or an anchor with aria-disabled and no href. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` | — | Render an anchor. Without it the link is a button for an in-page action. |
| `to / as` | `string \| object / ElementType` | — | as is your router's link component (react-router's Link, Next.js's Link); it gets to (or href) and must render an a. Without as, a string to becomes the href. |
| `label` | `string` | — | Text when you don't pass children. |
| `arrow` | `boolean` | false | Trailing arrow that nudges on hover. |
| `underline` | `boolean` | false | Underlined (link--ul). |
| `type` | `"button" \| "submit" \| "reset"` | "button" | Native type when rendered as a button. |
| `disabled` | `boolean` | false | Disabled button, or an anchor with aria-disabled and no href. |
