Hoppa till innehåll
Markdown

DropdownSelector

Generic wrapper for Sitevision select components used for selecting nodes.

Prefer the specialized wrappers for ordinary usage:

Use DropdownSelector when you need to configure the selector component directly.

<script>
import { DropdownSelector } from '@soleil-se/config-svelte';
</script>
<DropdownSelector name="metadata" component="metadata" label="Metadata" />
PropTypeDescription
component
required
string
'metadata' | 'template' | 'oauth2-configuration' | 'virtual-group' | 'search-index' | 'font' | 'color' | 'llm-configuration' | 'target-audience' | string
Sitevision component.
label
required
string | Snippet

Field label, a string or Svelte snippet.

value
$bindable
string

Selected node ID.

types
string | string[]
Filters selectable types for components that support filtering. Accepts one type, array or a comma-separated string.
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
(value: string, event: Event) => void

Called on a selection change.

validate
function
(context: ValidationContext<string>) => ValidationResult

Custom validator.

For custom options, use CustomSelector.
For tags, use TagSelector.

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.

label and description accept text or Svelte snippets.
Default child content is rendered after the select and validation message.

App.svelte
<script>
import { DropdownSelector } from '@soleil-se/config-svelte';
</script>
<DropdownSelector name="metadata" component="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>
</DropdownSelector>