shadcn.io is an independent project built on shadcn/ui
The label shows the name to type. From the start, the field says Project name does not match and Transfer stays disabled. A match does not transfer the project.
Ask for the name when a checkbox is too easy to tick, and enable the button only on an exact match. A lighter confirm is a Checkbox. In Svelte, Ark UI does not transfer the project.
Installation
Anatomy

Usage
<AlertDialog><AlertDialogTrigger>{#snippet asChild(props)}<Button {...props()} variant="outline">Transfer</Button>{/snippet}</AlertDialogTrigger><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Transfer Project</AlertDialogTitle><AlertDialogDescription>Type the project name to confirm the transfer.</AlertDialogDescription></AlertDialogHeader><Field invalid={invalid}><FieldLabel>Project Name: <span class="font-mono">{projectName}</span></FieldLabel><Input oninput={handleChange} placeholder="Type project name" type="text" value={value} /><FieldError>Project name does not match</FieldError></Field><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel><AlertDialogClose>{#snippet asChild(props)}<AlertDialogAction {...props({ disabled: invalid })}>Transfer</AlertDialogAction>{/snippet}</AlertDialogClose></AlertDialogFooter></AlertDialogContent></AlertDialog>FAQ
Type-to-confirm or a checkbox?
Type-to-confirm for actions on a named resource, since it proves people know which one. A checkbox for general acknowledgments, as in Destructive with Checkbox Confirmation.
Should the match be case-sensitive?
Match the system: project names and usernames usually are, so the demo compares exactly. Compare case-insensitively for things like email addresses.
How is the error shown?
The input is controlled, and the Field gets invalid while the value doesn't match. That colors the field, marks the input aria-invalid and shows its FieldError.
Should the error show before people finish typing?
The demo shows it from the start, like the original. In an app you may prefer to show it after the field loses focus, while still enabling the button the moment the name matches.
API Reference
Alert Dialog
Sets props, disabled and invalid. The rest is on the Alert Dialog page.
Button
Sets props and variant="outline". The rest is on the Button page.
Field
Sets invalid={invalid}. The rest is on the Field page.
Input
Sets oninput={handleChange}, placeholder="Type project name", type="text" and value={value}. The rest is on the Input page.





