Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,8 @@ slotConfig
slowlog
sm
smartbar
snackbar
snackbars
snakeCase
sortings
sourcemaps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,40 @@
}
});
```

## Using snackbars for brief feedback

::: info
The snackbar service is available from Shopware 6.7.14.0.
:::

For brief feedback such as confirming that a plugin action completed, use the global Meteor snackbar instead of the notification mixin:

```javascript
const snackbar = Shopware.Service('snackbarService').addSnackbar({

Check warning on line 55 in guides/plugins/plugins/administration/mixins-directives/using-mixins.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/administration/mixins-directives/using-mixins.md#L55

Add a space between sentences. (SENTENCE_WHITESPACE) Suggestions: ` Service` Rule: https://community.languagetool.org/rule/show/SENTENCE_WHITESPACE?lang=en-US Category: TYPOGRAPHY
Raw output
guides/plugins/plugins/administration/mixins-directives/using-mixins.md:55:26: Add a space between sentences. (SENTENCE_WHITESPACE)
 Suggestions: ` Service`
 Rule: https://community.languagetool.org/rule/show/SENTENCE_WHITESPACE?lang=en-US
 Category: TYPOGRAPHY
message: 'The settings have been saved.',
variant: 'success',
});
```

To dismiss a snackbar before its duration expires, pass its generated ID to `removeSnackbar()`:

```javascript
Shopware.Service('snackbarService').removeSnackbar(snackbar.id);

Check warning on line 64 in guides/plugins/plugins/administration/mixins-directives/using-mixins.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/plugins/plugins/administration/mixins-directives/using-mixins.md#L64

Add a space between sentences. (SENTENCE_WHITESPACE) Suggestions: ` Service` Rule: https://community.languagetool.org/rule/show/SENTENCE_WHITESPACE?lang=en-US Category: TYPOGRAPHY
Raw output
guides/plugins/plugins/administration/mixins-directives/using-mixins.md:64:9: Add a space between sentences. (SENTENCE_WHITESPACE)
 Suggestions: ` Service`
 Rule: https://community.languagetool.org/rule/show/SENTENCE_WHITESPACE?lang=en-US
 Category: TYPOGRAPHY
```

For Composition API extensions, use the `useSnackbar()` composable. It is experimental until Shopware 6.8.0 and requires the `ADMIN_COMPOSITION_API_EXTENSION_SYSTEM` feature flag:

```javascript
import useSnackbar from 'src/app/composables/use-snackbar';

const { addSnackbar, removeSnackbar } = useSnackbar();
const snackbar = addSnackbar({
message: 'The settings have been saved.',
variant: 'success',
});

removeSnackbar(snackbar.id);
```

The snackbar service is separate from the legacy notification system. Continue using the notification mixin when you need its title, actions, or system-notification behavior.
Loading