Skip to content

Conversation

@SethSharp
Copy link
Member

@SethSharp SethSharp commented Oct 16, 2025

Adds variant prop to confirm dialog config. Allows us to use our standard button variants, the dialog action doesn't specifically render a Button component, but passes the classes it would normally use.

image
confirmDialog({
  title: "Custom Dialog",
  description:
    "You can also provide a full object with label and handler to fully customise the confirm dialog.",
  variant: "destructive",
  // ... rest of config ...
})

Comment on lines 7 to 21
const props = defineProps<
AlertDialogActionProps & {
class?: HTMLAttributes["class"]
variant?: ButtonVariants["variant"]
}>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
</script>

<template>
<AlertDialogAction v-bind="delegatedProps" :class="cn(buttonVariants(), props.class)">
<AlertDialogAction v-bind="delegatedProps" :class="cn(buttonVariants({ variant }), props.class)">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to give variant a default here as buttonVariants will handle it accordingly

@SethSharp SethSharp marked this pull request as ready for review October 17, 2025 00:03
@SethSharp SethSharp marked this pull request as draft October 17, 2025 00:04
@SethSharp SethSharp marked this pull request as ready for review October 17, 2025 00:18
@SethSharp SethSharp merged commit d08717a into main Oct 17, 2025
2 checks passed
@SethSharp SethSharp deleted the seth/add-variant-prop-to-confirm-dialog branch October 17, 2025 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants