mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
* chore: update ignore rules, remove unused files * refactor(icons): use icons from carbon-icons-svelte@11 * docs(time-picker): fix default value * chore: upgrade carbon-icons-svelte to v11 * docs: update examples to use icons from carbon-icons-svelte@11 * docs: update number of icons [ci skip]
42 lines
920 B
Svelte
42 lines
920 B
Svelte
<script>
|
|
/** Set to `true` to use the active state */
|
|
export let linkIsActive = false;
|
|
|
|
/**
|
|
* Specify the `href` attribute
|
|
* @type {string}
|
|
*/
|
|
export let href = undefined;
|
|
|
|
/**
|
|
* Specify the icon to render
|
|
* @type {typeof import("svelte").SvelteComponent}
|
|
*/
|
|
export let icon = undefined;
|
|
|
|
/** Obtain a reference to the HTML anchor element */
|
|
export let ref = null;
|
|
</script>
|
|
|
|
<a
|
|
bind:this="{ref}"
|
|
class:bx--header__action="{true}"
|
|
class:bx--header__action--active="{linkIsActive}"
|
|
href="{href}"
|
|
rel="{$$restProps.target === '_blank' ? 'noopener noreferrer' : undefined}"
|
|
{...$$restProps}
|
|
>
|
|
<slot name="icon">
|
|
<svelte:component this="{icon}" size="{20}" />
|
|
</slot>
|
|
</a>
|
|
|
|
<style>
|
|
.bx--header__action {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
/** Hot fix to align icon with `HeaderAction` */
|
|
padding-bottom: 2px;
|
|
}
|
|
</style>
|