Kliping
KlipingBerandaDokumentasiKomponenBlocksVariasiTemplateDice UIHooks
Bagian
  • Pengenalan
  • Komponen
  • Instalasi
  • Tema & Kustomisasi
  • Mode Gelap
  • CLI
  • RTL
  • Skills
  • Server MCP
  • Form
  • Catatan Perubahan
Instalasi
  • Vite
  • Nuxt
  • Astro
  • Laravel
  • Manual
Mode Gelap
  • Vite
  • Nuxt
  • Vitepress
  • Astro
Form
  • VeeValidate
  • TanStack Form
  • Formisch
Registry
  • Ikhtisar
  • Memulai
  • Contoh
  • registry.json
  • registry-item.json
  • Tanya Jawab
Utilitas
  • scroll-fade
  • shimmer
Lainnya
  • components.json
  • JavaScript
  • Figma
  • Direktori Registry
  • Warna
  • Typeset
  • Dokumentasi Lama
  • Tentang
  • Kredit
  • Kontribusi
Komponen
  • Accordion
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Data Table
  • Date Picker
  • Dialog
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Form
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Pin Input
  • Popover
  • Progress
  • Questionnaire
  • Radio Group
  • Range Calendar
  • Resizable
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tags Input
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Typography

Vite

SebelumnyaBerikutnya

Memasang dan mengonfigurasi Kliping di project Vite.

Buat project ​

Mulai dengan membuat project Vue baru memakai vite:

bash
npm create vite@latest my-vue-app --template vue-ts

Pasang Tailwind CSS ​

bash
npm install tailwindcss @tailwindcss/vite

Ganti seluruh isi src/style.css dengan baris berikut:

css
@import "tailwindcss";

Sunting file tsconfig.json ​

Vite versi sekarang memecah konfigurasi TypeScript menjadi tiga file, dan dua di antaranya perlu Anda sunting. Tambahkan properti baseUrl dan paths ke bagian compilerOptions pada file tsconfig.json dan tsconfig.app.json:

json
{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.node.json"
    }
  ],
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Sunting file tsconfig.app.json ​

Tambahkan kode berikut ke tsconfig.app.json supaya path bisa diselesaikan dengan benar oleh IDE Anda:

json
{
  "compilerOptions": {
    // ...
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
    // ...
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

Perbarui vite.config.ts ​

Tambahkan kode berikut ke vite.config.ts supaya aplikasi Anda bisa menyelesaikan path tanpa error:

bash
npm install -D @types/node
typescript
import path from 'node:path'
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue(), tailwindcss()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
})

Pakai vite-tsconfig-paths untuk menyelesaikan import lewat path mapping milik TypeScript.

bash
npm install -D vite-tsconfig-paths
typescript
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import tailwindcss from '@tailwindcss/vite'
import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
  plugins: [vue(), tailwindcss(), tsconfigPaths()],
})

Jalankan CLI ​

Jalankan perintah init untuk menyiapkan project Anda:

bash
npx shadcn-vue@latest init

Anda akan ditanya beberapa hal untuk mengisi components.json.

txt
Which color would you like to use as base color? › Neutral

Tambahkan komponen ​

Sekarang Anda bisa mulai menambahkan komponen ke project.

bash
npx shadcn-vue@latest add button

Perintah di atas menambahkan komponen Button ke project Anda. Setelah itu, import seperti ini:

vue
<script setup lang="ts">
import { Button } from '@/components/ui/button'
</script>

<template>
  <div>
    <Button>Klik saya</Button>
  </div>
</template>
1
2
3
4
5
6
7
8
9
Catatan PerubahanNuxt

Di halaman ini

Buat projectPasang Tailwind CSSSunting file tsconfig.jsonSunting file tsconfig.app.jsonPerbarui vite.config.tsJalankan CLITambahkan komponen
Dirilis di bawah lisensi MIT. Ditulis ulang untuk Vue dari shadcn-vue, shadcn-ui-blocks, dan shadcn-hooks. Hak cipta © 2026 Kliping