Skip to content

Commit

Permalink
Also apply icon slot logic for link buttons
Browse files Browse the repository at this point in the history
Without this, a button link with an icon prop would not be rendered.
  • Loading branch information
metonym committed Feb 24, 2024
1 parent e1cc19f commit 82f708d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,17 @@
{/if}
<slot />
{#if $$slots.icon}
<svelte:component this="{icon}" {...iconProps} />
<slot
name="icon"
style="{hasIconOnly ? 'margin-left: 0' : undefined}"
{...iconProps}
/>
{:else if icon}
<slot name="icon" {...iconProps} />
<svelte:component
this="{icon}"
style="{hasIconOnly ? 'margin-left: 0' : undefined}"
{...iconProps}
/>
{/if}
</a>
{:else}
Expand Down

0 comments on commit 82f708d

Please sign in to comment.