Skip to main content

Buttons

Button primitive

The Button namespace re-exports the shadcn-svelte button with customizable variants powered by tailwind-variants.

<script lang="ts">
import { Button } from '@repo/components'
</script>

<Button.Root variant="default">Save</Button.Root>
<Button.Root variant="cta" size="lg">Submit</Button.Root>
<Button.Root variant="ghost" size="icon">X</Button.Root>

When an href prop is provided, the button renders as an <a> tag instead of <button>.

Variants

VariantDescription
defaultPrimary action with brand colors
destructiveBordered destructive style for delete/trash
destructive_ghostGhost-style destructive (hover only)
outlineBordered with transparent background
secondarySecondary action with border
ghostMinimal, no background until hover
linkTransparent, underline on hover
successGreen border/text, solid green on hover
ctaCall-to-action, used as default form submit button

Sizes

SizeDescription
defaultStandard (min-h-9 px-4)
smSmall (min-h-8 px-3)
lgLarge (min-h-10 px-8)
icon-xs24px round icon
icon-sm28px round icon
icon32px round icon
icon-lg36px round icon

Using buttonVariants directly

You can generate class strings without using the component:

import { Button } from '@repo/components'

const classes = Button.buttonVariants({ variant: 'destructive', size: 'sm' })

ConfirmationButton

Wraps any trigger content in a confirmation dialog. On confirm, submits a form action or remote form.

<script lang="ts">
import { ConfirmationButton } from '@repo/components'
</script>

<ConfirmationButton action="?/delete" title="Delete this record?">
Delete
</ConfirmationButton>

Props

PropTypeDescription
titlestringDialog title (default: "Are you sure?")
actionstringForm action URL
remoteFormRemoteForm<any, any>Alternative: use a remote form
onResult(result) => voidCallback after form submission
childrenSnippetTrigger content
descriptionSnippetOptional dialog description

Use either action or remoteForm, not both.

CopyButton

Copies text to clipboard with visual feedback (check icon for 5s, toast notification).

<script lang="ts">
import { CopyButton } from '@repo/components'
</script>

<CopyButton text="some-id-to-copy" variant="ghost" size="icon-sm" />

Props

Extends all Button props, plus:

PropTypeDescription
textstringText to copy

Customizing variants

Button variants can be overridden app-wide via StyleProvider. See the Custom Styling guide.