Components
Client Only
Installation
pnpm dlx @docyrus/cli add @docyrus/ui-record-delete-confirm-dialogUI Primitives(5 components)
npx shadcn@latest add alert-dialog button label radio-group tableUsage
import { RecordDeleteConfirmDialog } from "@docyrus/ui/components/record-delete-confirm-dialog";
import type { DataSourceRelation } from "@docyrus/ui/components/record-delete-confirm-dialog";
import { useState } from "react";
const relations: DataSourceRelation[] = [
{ dataSourceId: "tasks", dataSourceName: "Tasks", dataSourceSlug: "tasks", appSlug: "base", dataSourceType: "table", fieldId: "task_id", fieldSlug: "task_id", fieldName: "Task", fieldType: "relation" }
];
function Demo() {
const [open, setOpen] = useState(false);
return (
<RecordDeleteConfirmDialog
open={open}
onOpenChange={setOpen}
recordCount={2}
relations={relations}
onConfirm={(childActions) => console.log(childActions)}
/>
);
}API Reference
| Prop | Type | Default |
|---|---|---|
open | boolean | — |
onOpenChange | (open: boolean) => void | — |
recordCount | number | — |
relations | DataSourceRelation[] | [] |
isLoadingRelations | boolean | false |
onConfirm | (childActions: Record<string, ChildAction>) => void | Promise<void> | — |
isPending | boolean | false |
className | string | — |
Components
| Component | Description |
|---|---|
RecordDeleteConfirmDialog | Public export |
Type Exports
| Type | Description |
|---|---|
DataSourceRelation | — |
Type Reference
DataSourceRelation
| Field | Type | Description |
|---|---|---|
dataSourceId | string | — |
dataSourceName | string | — |
dataSourceSlug | string | — |
appSlug | string | — |
dataSourceType | string | — |
fieldId | string | — |
fieldSlug | string | — |
fieldName | string | — |
fieldType | string | — |