mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
add OutboundLink (#504)
* feat(link): add OutboundLink * fix(outbound-link): forward Link events
This commit is contained in:
parent
3e926de49d
commit
251f986304
8 changed files with 85 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { Link } from "carbon-components-svelte";
|
||||
import { Link, OutboundLink } from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
|
@ -9,14 +9,18 @@
|
|||
|
||||
### Target _blank
|
||||
|
||||
Setting `target` to `"_blank"` opens the link in a new tab.
|
||||
|
||||
If `target="_blank"`, the `Link` component will automatically set `rel="noopener noreferrer"` to guard against [potential cross-origin security exploits](https://web.dev/external-anchors-use-rel-noopener/).
|
||||
If setting `target` to `"_blank"`, the `Link` component will automatically set `rel="noopener noreferrer"` to guard against [potential cross-origin security exploits](https://web.dev/external-anchors-use-rel-noopener/).
|
||||
|
||||
You can override the `rel` attribute with a custom value.
|
||||
|
||||
<Link href="https://www.carbondesignsystem.com/" target="_blank">Carbon Design System</Link>
|
||||
|
||||
### Outbound link
|
||||
|
||||
An alternative to manually setting `target` to `"_blank"` is to use the `OutboundLink`.
|
||||
|
||||
<OutboundLink href="https://www.carbondesignsystem.com/">Carbon Design System</OutboundLink>
|
||||
|
||||
### Inline variant
|
||||
|
||||
<div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue