diff --git a/src/Button/Button.svelte b/src/Button/Button.svelte index 400e68d0..e182f293 100644 --- a/src/Button/Button.svelte +++ b/src/Button/Button.svelte @@ -27,6 +27,8 @@ /** * Specify the icon to render + * Alternatively, use the named slot "icon" (e.g., ``) + * * @type {typeof import("svelte").SvelteComponent} */ export let icon = undefined; @@ -85,7 +87,12 @@ $: if (ctx && ref) { ctx.declareRef(ref); } - $: hasIconOnly = icon && !$$slots.default; + $: hasIconOnly = (icon || $$slots.icon) && !$$slots.default; + $: iconProps = { + "aria-hidden": "true", + class: "bx--btn__icon", + "aria-label": iconDescription, + }; $: buttonProps = { type: href && !disabled ? undefined : type, tabindex, @@ -158,12 +165,12 @@ {#if hasIconOnly} {iconDescription} {/if} -