Hoppa till innehåll

ImageSelector

Custom panel component for selecting an image.

ImageSelector

PropTypeDescription
headingstringPanel heading.
Default: 'Bild'
namestringName attribute.
Default: undefined
requiredbooleanIf the field is required.
Default: false
nodestringNode ID of the selected image.
Default: undefined
altstringCustom alt text.
Default: undefined
decorativebooleanIf the image is decorative.
Default: false
showbooleanShow and hide the component without re-rendering.
Default: true
hideDecorativebooleanIf the checkbox for decorative image should be hidden.
Default: false
<script>
import { ImageSelector } from '@soleil-se/config-svelte';
</script>
<ImageSelector name="image" heading="Bild" />
<!-- If decorative should be checked from the start, since 1.11.0 -->
<ImageSelector name="image" heading="Bild" decorative />

If used with standard name all values will be prefixed with the name property provided to the component.
For example if name="image" the values will be available as imageNode, imageAlt (if custom alt-text is set) and imageDecorative (if image is set as decorative, since 1.11.0).

import appData from '@sitevision/api/server/appData';
function getImage() {
return {
uri: appData.get('imageNode', 'URI'),
alt: appData.get('imageDecorative') ? '' : appData.get('imageAlt') || appData.get('imageNode', 'alt'),
}
}

Default slot

<ImageSelector name="image" heading="Bild" />
<p>Some text.</p>
</ImageSelector>