Composables
WARNING
Single File Component (SFC) support for Administration extensions is experimental. It is available since Shopware 6.7.16.0. The APIs described on this page can still change without a deprecation. Try it out and tell us what you find, but do not ship an extension built on it to customers or to the Shopware Store until the API is declared stable (planned for 6.9).
All composables the Administration offers are experimental. Their names, options and return values can still change without a deprecation, so note which ones you rely on and tell us when one of them does not fit what you are building.
Override composables
Three of them are provided by the build in every .override.vue file. Like the macros, you never import them, and they exist only inside an override file. They are how an override reaches the component it overrides.
A base component needs none of them: it declares its own props with defineProps() and its own events with defineEmits().
Administration composables
Everything else is imported by name from the shopware:composables virtual module:
import { useNotification } from 'shopware:composables';Each composable is also available as a default export of its own import path, named after it in camelCase (import useNotification from 'shopware:composables/useNotification').
Each of them is the Composition API side of a mixin. A mixin declared its own props and read them off this; a composable has neither, so whatever the mixin used to take from its host is passed in, and getters keep it reactive:
const { isBetween, betweenValue } = useRuleBetweenOperator({
condition: () => props.condition,
ensureValueExist: () => emit('ensure-value-exist'),
});The mixins stay where they are, so an Options API component that has not been migrated keeps working.