Skip to content
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
2 changes: 1 addition & 1 deletion src/lib/Link/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

<a
href={calcHref}
class={[cssClass, { [activeState?.class ?? '']: isActive }]}
class={[cssClass, (isActive && activeState?.class) || undefined]}
style={isActive ? styleString() : undefined}
aria-current={isActive ? (activeState?.ariaCurrent ?? 'page') : undefined}
onclick={handleClick}
Expand Down
8 changes: 5 additions & 3 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HTMLAnchorAttributes } from "svelte/elements";
import type { ClassValue, HTMLAnchorAttributes } from "svelte/elements";
import type { SvelteURL } from "svelte/reactivity";

/**
Expand Down Expand Up @@ -297,11 +297,13 @@ export type ActiveState = {
*/
key?: string;
/**
* Sets the class that the link will use when rendering as active.
* Sets the class or classes that the link will use when rendering as active.
*
* For example, set it to `"active"` for Bootstrap setups.
*
* **TIP**: You can use any value type that is accepted by the popular `clsx` library.
*/
class?: string;
class?: ClassValue;
/**
* Sets the style that the link will use when rendering as active.
*
Expand Down