18 lines
682 B
Svelte
18 lines
682 B
Svelte
<script lang="ts">
|
|
import { cn } from "$lib/utils.js";
|
|
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
let { class: className = "", value = "", selected = false, onclick, children, ...rest }: HTMLButtonAttributes & { value?: string; selected?: boolean } = $props();
|
|
</script>
|
|
<button
|
|
class={cn(
|
|
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium transition-all",
|
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
selected ? "bg-background text-foreground shadow-sm" : "hover:bg-background/50 hover:text-foreground",
|
|
className
|
|
)}
|
|
{onclick}
|
|
{...rest}
|
|
>
|
|
{@render children?.()}
|
|
</button>
|