MetadataSelector
Select a metadata definition.
This component wraps DropdownSelector with component="metadata".
This is a field description.
Example
Section titled “Example”<script> import { MetadataSelector } from '@soleil-se/config-svelte';</script>
<MetadataSelector name="metadata" label="Metadata" description="This is a field description."/>
<MetadataSelector name="metadata" label="Metadata" types={['sv:metadataTextDefinition', 'sv:metadataLinkDefinition']}/>| Prop | Type | Description |
|---|---|---|
types | MetadataNodeType | MetadataNodeType[] | Restricts the selectable metadata definition types. |
The following props are inherited from the DropdownSelector component.
| Prop | Type | Description |
|---|---|---|
labelrequired | string | Snippet | Field label, a string or Svelte snippet. |
value$bindable | string | Selected node ID. |
name | string | Configuration key and HTML name attribute. |
description | string | Snippet | Description shown below the field, a string or Svelte snippet. |
required | boolean | Set the field as required. Default:false |
disabled | boolean | Disables the field. Default:false |
show | boolean | Shows or hides the selector without destroying it. Default:true |
class | string | CSS class added to the form-group wrapper. |
children | Snippet | Content rendered after the selector and validation message. |
onChange | function | Called on a selection change. |
validate | function | Custom validator. |
Validation
Section titled “Validation”By default, the component applies standard required-field validation. A custom validate prop
replaces that default and returns { success: boolean, message?: string }.
Validation errors are displayed below the component and prevent saving.
See validation for more details.
Snippets
Section titled “Snippets”label and description accept text or Svelte snippets.
Default child content is rendered after the metadata selector and validation message.
<script> import { MetadataSelector } from '@soleil-se/config-svelte';</script>
<MetadataSelector name="metadata"> {#snippet label()} Välj <strong>metadata</strong> {/snippet} {#snippet description()} Välj metadata för <strong>innehållet</strong>. {/snippet} <p>Ytterligare information.</p></MetadataSelector>