MonoStack
Concepts

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

Renders a consistent action trigger and confirmation dialog. On confirm, it submits a form action or remote form.

<script lang="ts">
  import { ConfirmationButton } from '@repo/components'
  import Trash2 from '@lucide/svelte/icons/trash-2'
</script>

<ConfirmationButton action="?/delete" label="Delete" icon={Trash2} title="Delete this record?" />

Props

PropTypeDescription
labelstringTrigger text
iconComponentOptional trigger icon
titlestringDialog title (default: "Are you sure?")
descriptionstringOptional dialog description
actionstringForm action URL
remoteFormRemoteForm<Input, Output>Alternative: use a remote form
onResult(result) => voidCallback after form submission
formFieldsSnippetOptional hidden or additional form fields
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.

On this page