Skip to main content

CnCopyDialog

Two-phase single-item copy dialog with naming pattern selector. User picks a naming pattern, confirms, then sees success or error.

Try it​

Loading CnCopyDialog playground…

Wraps: NcDialog, NcButton, NcNoteCard, NcSelect

CnCopyDialog showing naming pattern selection for copying an item

Props​

PropTypeDefaultDescription
itemObject(required)Item to copy
nameFieldString'title'Field used as display name
nameFormatterFunctionnullOptional function (item) => string to format the display name. Overrides nameField when provided.
dialogTitleString'Copy Item'
patternLabelString'Naming pattern'
successTextString'Item successfully copied.'
cancelLabelString
closeLabelString
confirmLabelString

Naming Patterns​

PatternExample
copy-ofCopy of Contact A
name-copyContact A - Copy
name-parensContact A (Copy)

Events​

EventPayloadDescription
confirm\{ id, newName \}Copy confirmed
close—Dialog closed

Public Methods​

MethodDescription
setResult(\{ success?, error? \})Set operation result

Live demo​

<template>
<div>
<button @click="open = true" style="padding: 6px 16px; border-radius: 4px; background: var(--color-primary-element); color: white; border: none; cursor: pointer;">Copy item</button>
<CnCopyDialog
v-if="open"
ref="dlg"
:item="{ id: 1, title: 'Annual Report 2024' }"
@confirm="onConfirm"
@close="open = false" />
</div>
</template>
<script>
export default {
data() { return { open: false } },
methods: {
async onConfirm({ id, newName }) {
await new Promise(r => setTimeout(r, 800))
this.$refs.dlg.setResult({ success: true })
},
},
}
</script>

Reference (auto-generated)​

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnCopyDialog.vue and update automatically whenever the component changes.

Props​

NameTypeRequiredDefaultDescription
itemobject✓—The item to copy. Must have an id property.
nameFieldstring'title'Property name used for display (e.g., 'title', 'name')
nameFormatterfuncnullOptional function to format the item name. Receives the item, returns a string. Overrides nameField when provided.
dialogTitlestring() =&gt; t('nextcloud-vue', 'Copy item')Dialog title
patternLabelstring() =&gt; t('nextcloud-vue', 'Naming pattern')Label for the naming pattern selector
successTextstring() =&gt; t('nextcloud-vue', 'Item successfully copied.')Success message
cancelLabelstring() =&gt; t('nextcloud-vue', 'Cancel')Label for the cancel button (visible before the copy runs).
closeLabelstring() =&gt; t('nextcloud-vue', 'Close')Label for the close button (visible after copy completes).
confirmLabelstring() =&gt; t('nextcloud-vue', 'Copy')Label for the primary confirm button that triggers the copy.

Events​

NamePayloadDescription
close—
confirm—

Methods​

NameDescription
setResultSet the result of the copy operation. Call this from the parent after the API call completes.