value
Description
Optional. An array of task objects to initialize the tasklist widgetUsage
value?: string | number | {
id?: string | number;
content: string;
status?: number;
}[];
Parameters
The value property can be defined in several ways:
- string | number – a task identifier
- an array of task objects. Each task object may include:
id
– (optional) a unique identifier of the taskcontent
– (required) the text content of the taskstatus
– (optional) the status of the task that can be 0 for incomplete and 1 for complete
Examples
Initializing tasklist widget with data
<script>
import { Tasklist } from '@svar-ui/svelte-tasklist';
const value = [
{
id: 7,
content: "Optimize performance in Svelte applications",
status: 1,
},
{
id: 8,
content:
"Work with API requests and data handling in Svelte applications",
status: 0,
}
];
</script>
<Tasklist {value} />
Initializing an empty tasklist widget
<script>
import { Tasklist } from '@svar-ui/svelte-tasklist';
</script>
<Tasklist />
Initializing widget and loading tasks
<script>
import { Tasklist } from '@svar-ui/svelte-tasklist';
let value = [];
fetch('/api/tasks')
.then(r => r.json())
.then(x => value = x);
</script>
{#await value}
<Tasklist {value} />
{/await}