switch

Switch list in card with icons

Switch list in card with icons

Загрузка превью…

src/switch/c-switch-7.vue

<script setup lang="ts">
import { Card } from "@/components/ui/card"
import { Field, FieldGroup, FieldLabel, FieldTitle } from "@/components/ui/field"
import { Separator } from "@/components/ui/separator"
import { Switch } from "@/components/ui/switch"
</script>

<template>
  <Card class="w-full max-w-xs p-0">
    <FieldGroup class="gap-0">
      <Field>
        <FieldLabel class="justify-between px-4 py-3">
          <FieldTitle class="flex items-center gap-2">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="24"
              height="24"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="2"
              stroke-linecap="round"
              stroke-linejoin="round"
              class="lucide lucide-bell size-4 opacity-60"
              aria-hidden="true"
            >
              <path d="M10.268 21a2 2 0 0 0 3.464 0" />
              <path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" />
            </svg>
            Push notifications
          </FieldTitle>
          <Switch :default-value="true" />
        </FieldLabel>
      </Field>
      <Separator />
      <Field>
        <FieldLabel class="justify-between px-4 py-3">
          <FieldTitle class="flex items-center gap-2">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="24"
              height="24"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="2"
              stroke-linecap="round"
              stroke-linejoin="round"
              class="lucide lucide-mail size-4 opacity-60"
              aria-hidden="true"
            >
              <path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" />
              <rect x="2" y="4" width="20" height="16" rx="2" />
            </svg>
            Email notifications
          </FieldTitle>
          <Switch />
        </FieldLabel>
      </Field>
      <Separator />
      <Field>
        <FieldLabel class="justify-between px-4 py-3">
          <FieldTitle class="flex items-center gap-2">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="24"
              height="24"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="2"
              stroke-linecap="round"
              stroke-linejoin="round"
              class="lucide lucide-smartphone size-4 opacity-60"
              aria-hidden="true"
            >
              <rect width="14" height="20" x="5" y="2" rx="2" ry="2" />
              <path d="M12 18h.01" />
            </svg>
            SMS notifications
          </FieldTitle>
          <Switch />
        </FieldLabel>
      </Field>
    </FieldGroup>
  </Card>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-switch-7.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)