shadcn-vue/apps/www/.vitepress/theme/components/TabPreview.vue
Sadegh Barati d03067db67
feat: add vee-validate (#85)
* feat: add `vee-validate`

* chore: update

* chore: update `AccountForm` example

- add `FormDescription` component
- include `src` in tsconfig

* refactor: use radix-vue `Slot` component

* chore: refresh lockfile

* chore: update `ProfileForm.vue` and `AccountForm`

fix vee-validate initialValues on components with `componentField` slotProp

* chore: update `AppearanceForm.vue`

update pnpm and some deps -_-

* refactor: update

- add new-york style
- off eslint import/first rule
- use `useId` from radix-vue

* fix: class-name -> class

* refactor: simplify validation for `Command` component

* fix: v-bind="field" -> v-bind="componentField"

* fix: useAttrs to prevent class duplication

* docs: add `form.md`

- change TabPreview.vue to showcase way of using vee-validate

* docs: add form example for `checkbox` `input` and `datepicker`

* docs: add `combobox`, `datepicker`, `radio-group`, `select`, `switch` and `textarea` form and some other exmaples

* chore: typo, update `zod`, `vite`, and `@vitejs/plugin-vue`
2023-10-06 12:04:38 +08:00

37 lines
1.2 KiB
Vue

<script setup lang="ts">
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/lib/registry/default/ui/tabs'
const props = withDefaults(defineProps<{
name: string
names?: string[]
align?: 'center' | 'start' | 'end'
sfcTsCode?: string
sfcTsHtml?: string
}>(), {
align: 'center',
names: () => ['CLI', 'Manual'],
})
</script>
<template>
<div>
<Tabs :default-value="props.name" class="relative mr-auto w-full">
<div class="flex items-center justify-between pb-3">
<TabsList class="w-full justify-start rounded-none border-b bg-transparent p-0">
<TabsTrigger
v-for="(tab, index) in props.names"
:key="index"
:value="tab"
class="relative h-9 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 font-semibold text-muted-foreground shadow-none transition-none data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none"
>
{{ tab }}
</TabsTrigger>
</TabsList>
</div>
<TabsContent v-for="(tab, index) in props.names" :key="index" :value="tab" class="relative space-y-10">
<slot :name="tab" />
</TabsContent>
</Tabs>
</div>
</template>