diff --git a/front/src/components/common/DangerousButton.vue b/front/src/components/common/DangerousButton.vue index 5cbef31d3..e44d25759 100644 --- a/front/src/components/common/DangerousButton.vue +++ b/front/src/components/common/DangerousButton.vue @@ -18,8 +18,8 @@ const { t } = useI18n() const emit = defineEmits() const props = withDefaults(defineProps(), { - action: () => undefined, - disabled: false, + action: () => undefined, // -> Button.onClick prop + disabled: false, // -> Pure html/css. Just add attribute `disabled` and the button is inert. confirmColor: 'destructive' }) diff --git a/front/src/components/ui/Button.vue b/front/src/components/ui/Button.vue index 05fc09816..3e839e5e7 100644 --- a/front/src/components/ui/Button.vue +++ b/front/src/components/ui/Button.vue @@ -1,5 +1,5 @@ @@ -71,13 +81,14 @@ Use the `#actions` slot to add actions to a modal. Actions typically take the fo ``` +
Modal content @@ -85,18 +96,89 @@ Use the `#actions` slot to add actions to a modal. Actions typically take the fo +
+ + + +### Confirm a dangerous action + +Note that confirmation dialogs interrupt the user's workflow. Consider adding a recovery functionality such as "undo" instead. + +::: tip Read more about designing user experiences around dangerous actions: + +- [How to use visual signals and spacing to differentiate between benign and dangerous options](https://www.nngroup.com/articles/proximity-consequential-options/) +> If you need to implement dangerous actions, make sure to place them apart from other actions to prevent accidental clicks. Add contextual hints and information so that the user understands the consequences of the action. + +- [How to design a confirmation dialog](https://www.nngroup.com/articles/confirmation-dialog/) +> 1. Let the user confirm potentially destructive actions +> 2. Do not use confirmation dialogs for routine tasks +> 3. Be specific about the action and its potential consequences +> 4. Label the response buttons with their result: "Delete my account" instead of "Yes" +> 5. Make sure to give the user all information they need to decide + +::: + +```vue-html + + +Do you want to delete your account forever? + +You will not be able to restore your account. + + + +``` + + + +Do you want to delete your account forever? + +You will not be able to restore your account. + + + ## Nested modals You can nest modals to allow users to isOpen a modal from inside another modal. This can be useful when creating a multi-step workflow. + + ```vue-html Nested modal content - @@ -106,22 +188,28 @@ You can nest modals to allow users to isOpen a modal from inside another modal. ``` +
Nested modal content - +
+ +
## Alert inside modal You can nest [Funkwhale alerts](./alert) to visually highlight content within the modal. + + ```vue-html Modal content @@ -131,7 +219,7 @@ You can nest [Funkwhale alerts](./alert) to visually highlight content within th Alert content @@ -142,13 +230,14 @@ You can nest [Funkwhale alerts](./alert) to visually highlight content within th ``` +
Modal content @@ -164,3 +253,6 @@ You can nest [Funkwhale alerts](./alert) to visually highlight content within th +
+ +