Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(link): add href prop #301

Merged
merged 2 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -2179,6 +2179,7 @@ import { Link } from "carbon-components-svelte";

| Prop name | Type | Default value |
| :-------- | :--------------------------------------------------------------------- | :------------ |
| href | <code>string</code> | -- |
| inline | <code>boolean</code> | false |
| disabled | <code>boolean</code> | false |
| visited | <code>boolean</code> | false |
Expand Down
7 changes: 7 additions & 0 deletions src/Link/Link.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<script>
/**
* Specify the href value
* @type {string} [href]
*/
export let href = undefined;

/**
* Set to `true` to use the inline variant
* @type {boolean} [inline=false]
Expand Down Expand Up @@ -48,6 +54,7 @@
class:bx--link--inline="{inline}"
class:bx--link--visited="{visited}"
rel="{$$restProps.target === '_blank' ? 'noopener noreferrer' : undefined}"
{href}
{...$$restProps}
on:click
on:mouseover
Expand Down
5 changes: 5 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,11 @@ export class InlineNotification extends CarbonSvelteComponent {

export class Link extends CarbonSvelteComponent {
$$prop_def: {
/**
albertms10 marked this conversation as resolved.
Show resolved Hide resolved
* Specify the href value
*/
href?: string;

/**
* Set to `true` to use the inline variant
* @default false
Expand Down