Docs
Button

Button

Displays a button or a component that looks like a button.

Loading...

Installation

	npx shadcn-svelte@latest add button

Usage

	<script lang="ts">
  import { Button } from "$lib/components/ui/button";
</script>
	<Button variant="outline">Button</Button>

You can convert the <button> into an <a> element by simply passing an href as a prop.

	<script lang="ts">
  import { Button } from "$lib/components/ui/button";
</script>
 
<Button href="/dashboard">Dashboard</Button>

Alternatively, you can use the buttonVariants helper to create a link that looks like a button.

	<script lang="ts">
  import { buttonVariants } from "$lib/components/ui/button";
</script>
 
<a href="/dashboard" class={buttonVariants({ variant: "outline" })}>
  Dashboard
</a>

Examples

Primary

Loading...

Secondary

Loading...

Destructive

Loading...

Outline

Loading...

Ghost

Loading...

Loading...

With Icon

Loading...

Icon

Loading...

Loading

Loading...