Link component
The <Link>
component works just like a normal Markdown link, but with a few additional useful features.
- You can set
target="_blank"
to open links in a new tab - You can add a custom class with
class="custom class"
- The link text can be arbitrary Markdown
Attributes
The <Link>
component can be customized using the following attributes.
Custom class
You can add a custom class to your link with the class
attribute:
<Link href="/" class="custom-styles">Click here</Link>
Opening links in a new tab
You can make the link open in a new tag with target="_blank"
<Link href="/" target="_blank">Open in new tab</Link>
Download links
You can make the link download a file by pointing the href
to a file in the _assets
directory, or to any OpenAPI specification you've defined in your settings file.
<Link href="/_assets/test.csv" download>Download CSV</Link>
<Link href="/_assets/test.csv" download_as="renamed.csv">Download renamed CSV</Link>
Downloading links to OpenAPI specifications
You can create a link to download an OpenAPI specification by pointing the href
to the location of the OpenAPI specification defined in your doctave.yaml
file.
<Link href="/petstore.json" download>Download OpenAPI spec</Link>
Download links currently only work in production. Clicking a download link in Doctave Studio will do nothing.