Hoppa till innehåll

TextList

Custom list component for adding multiple text values and sorting them.

TextList

PropTypeDescription
idstringUnique identifier for the component.
Default: generateId()
labelstringLabel for the text list.
descriptionstringDescription text displayed below the input field.
requiredbooleanIf the field is required.
Default: false
namestringName attribute for the text list.
Default: undefined
disabledbooleanIf the field is disabled.
Default: false
showbooleanShow or hide the component without re-rendering.
Default: true
valueArray<string>Bound value for the text list.
Default: []

Use the value attribute to set a default value:

<TextList
name="textList"
label="Text List"
value={['Text 1']}
/>
<script>
import { Panel, TextList } from '@soleil-se/config-svelte';
</script>
<Panel heading="Inställningar">
<TextList name="textList" label="Text List" />
</Panel>
Advanced
<script>
import { Panel, TextList } from '@soleil-se/config-svelte';
import { onSave } from '@soleil-se/config-svelte/utils';
const values = {
textList: '',
...window.CONFIG_VALUES
};
onSave(() => values);
</script>
<Panel heading="Inställningar">
<TextList bind:value={values.textList} label="Text List" />
</Panel>

Default slot after text list.

<TextList name="textList" label="Text List">
<p>Some text</p>
</TextList>

Slot for content in the label element.

<TextList name="textList">
{#snippet label()}
Custom <strong>label</strong>
{/snippet}
</TextList>

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

<TextList name="textList">
{#snippet description()}
Custom <strong>description</strong>
{/snippet}
</TextList>