Action Button

Previous Next

A button that performs an action when clicked and optionally asks for user confirmation.

Installation

pnpm dlx shadcn-svelte@latest add https://wds-shadcn-registry-svelte.netlify.app/registry/action-button.json

Usage

<script lang="ts">
	import { ActionButton } from '$lib/components/action-button';
	import { updateSettings } from '$lib/actions/settings';
 
	const settings = { name: 'Kyle' };
</script>
 
<ActionButton action={updateSettings.bind(null, settings)} requireAreYouSure>
	Save Settings
</ActionButton>

Examples

Default

Require Are You Sure

With Error