Ga naar hoofdinhoud

CnDialogActions

The footer of a hand-built dialog: a cancel button and a primary button. While the dialog saves, both buttons are disabled and the primary button shows a loading icon. A cancel cannot stop a save that already runs, so it is not offered.

Use it in the actions slot of CnDialog when the body is too custom for CnFormDialog. The component keeps no state: your dialog owns saving and canSubmit and does the work on submit.

Import​

import { CnDialogActions } from '@conduction/nextcloud-vue'

Usage​

<CnDialog :name="t('myapp', 'Edit source')" default-width="form" @closing="close">
<MySourceForm v-model="source" />
<template #actions>
<CnDialogActions
:saving="saving"
:can-submit="source.title !== ''"
:confirm-label="editing ? t('myapp', 'Save') : t('myapp', 'Create')"
@cancel="close"
@submit="save" />
</template>
</CnDialog>

Props​

PropTypeDefaultDescription
savingBooleanfalseA save is running. Disables both buttons and draws a loading icon on the primary one.
canSubmitBooleantrueThe dialog holds enough to submit. false disables the primary button.
confirmLabelString'Save'Primary button label.
cancelLabelString'Cancel'Cancel button label.
variantString'primary'Primary button variant: primary, secondary, error, warning or success.
confirmIconString''A CnIcon name drawn on the primary button when it is not saving.

Events​

EventPayloadDescription
cancelThe cancel button was clicked.
submitThe primary button was clicked.

Accessibility​

The loading icon has the accessible name "Loading …", so a screen reader announces that the save is running.