Toggle Setting List
blocklayoutList of toggle-able settings in a SectionCard. Spell rows out inline with ToggleSettingRow — each row binds `checked` (bind:checked).
Installation
$pnpm dlx shadcn-svelte@latest add https://uipkge.dev/r/svelte/toggle-setting-list.json$npx shadcn-svelte@latest add https://uipkge.dev/r/svelte/toggle-setting-list.json$yarn dlx shadcn-svelte@latest add https://uipkge.dev/r/svelte/toggle-setting-list.json$bunx shadcn-svelte@latest add https://uipkge.dev/r/svelte/toggle-setting-list.jsonManifest:
https://uipkge.dev/r/svelte/toggle-setting-list.jsonInstalls to:src/lib/components/blocks/toggle-setting-list/Variants
Loading interactive previews…
Loading interactive previews…
Includes
Files installed (2)
src/lib/components/blocks/toggle-setting-list/ToggleSettingList.svelte0.7 kB
<script lang="ts"> import type { Component, Snippet } from 'svelte' import { SectionCard } from '$lib/components/ui/section-card' interface Props { title?: string description?: string headerIcon?: Component class?: string children?: Snippet } let { title = 'Notifications', description, headerIcon: HeaderIcon, class: className, children }: Props = $props() </script> <SectionCard data-slot="toggle-setting-list" {title} {description} class={className}> {#snippet headerAction()} {#if HeaderIcon} <HeaderIcon class="text-muted-foreground size-5" /> {/if} {/snippet} <ul class="-my-4 divide-y"> {@render children?.()} </ul> </SectionCard>src/lib/components/blocks/toggle-setting-list/ToggleSettingRow.svelte1.1 kB
<script lang="ts"> import { cn } from '$lib/utils' interface Props { label: string desc?: string checked?: boolean } let { label, desc, checked = $bindable(false) }: Props = $props() </script> <!-- One controlled switch row. Hold state in the parent and bind `checked` per row. --> <li class="flex items-center justify-between gap-4 py-4 first:pt-0"> <div> <p class="text-sm font-medium">{label}</p> {#if desc} <p class="text-muted-foreground text-xs">{desc}</p> {/if} </div> <button type="button" role="switch" aria-label={label} aria-checked={checked} class={cn( 'focus-visible:ring-ring relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none focus-visible:ring-2', checked ? 'bg-primary' : 'bg-muted-foreground/30', )} onclick={() => (checked = !checked)} > <span class={cn( 'bg-background inline-block size-4 translate-y-0.5 rounded-full shadow transition-transform', checked ? 'translate-x-[18px]' : 'translate-x-0.5', )} ></span> </button> </li>
Raw manifest:https://uipkge.dev/r/svelte/toggle-setting-list.json