Hoppa till innehåll

DropdownSelector

Wrapper component for Sitevision selects.

DropdownSelector

PropTypeDescription
idstringID, generates automatically if nothing is passed.
Default: generateId()
labelstringLabel for the selector. Required.
Default: undefined
descriptionstringDescription for the selector, displayed below the label.
Default: undefined
namestringName attribute for the selector.
Default: undefined
typestringType of the selector.
Default: 'metadata'
selectableArray<any>Filter for selectable types.
Default: []
requiredbooleanWhether the selector is required.
Default: false
disabledbooleanDisable the selector.
Default: false
showbooleanShow and hide the component without re-rendering.
Default: true
valuestringValue associated with the selector.
Default: ''

Possible values for type:

  • metadata
  • template
  • oauth2-configuration
  • virtual-group
  • search-index
  • font
  • color

For custom-selector use CustomSelector.

<script>
import { Panel, DropdownSelector } from '@soleil-se/config-svelte';
</script>
<Panel heading="Inställningar">
<DropdownSelector name="metadata" type="metadata" label="Metadata" />
</Panel>
Advanced
<script>
import { Panel, DropdownSelector } from '@soleil-se/config-svelte';
import { onSave } from '@soleil-se/config-svelte/utils';
const values = {
metadata: '',
...window.CONFIG_VALUES
};
onSave(() => values);
</script>
<Panel heading="Inställningar">
<DropdownSelector bind:value={values.metadata} type="metadata" label="Metadata" />
</Panel>

You can omnit the -selector suffix for the type prop.

<DropdownSelector name="metadata" type="metadata" label="Metadata" />

❗ Since SiteVision 7.0 ❗

Filter what types should be selectable. See available types here: https://developer.sitevision.se/docs/webapps/webapps-2/configuration/sitevision-components#h-Types

Accepts an Array or String.

<DropdownSelector
name="metadata"
type="metadata-selector"
label="Metadata"
selectable="sv:metadataLinkDefinition"
selectable={['sv:metadataLinkDefinition', 'sv:metadataDateDefinition']}
/>

Default slot after selector.

<DropdownSelector name="metadata" label="Metadata" {options} >
<p class="help-block">Some helpful text.</p>
</CustomSelector>

Slot for content in the label element.

<DropdownSelector name="metadata" {options} >
{#snippet label()}
Custom <strong>label</strong>
{/snippet}
</DropdownSelector>

Slot for content in the description element to be used instead of the prop when HTML formatting is needed.

<DropdownSelector name="metadata" {options} >
{#snippet description()}
Custom <strong>description</strong>
{/snippet}
</DropdownSelector>