- Accordion
- Action Bar
- Alert
- Alert Dialog
- Angle Slider
- Aspect Ratio
- Attachment
- Avatar
- Avatar Group
- Badge
- Badge Overflow
- Banner
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Chip
- Circular Progress
- Client Only
- Collapsible
- Color Picker
- Color Swatch
- Combobox
- Combobox Advanced
- Command
- Compare Slider
- Composition
- Context Menu
- Cropper
- Data Grid
- Data Table
- Data Table Advanced
- Date Picker
- Dialog
- Direction Provider
- Drawer
- Dropdown Menu
- Editable
- Empty
- Field
- File Upload
- Form
- FPS
- Gauge
- Hitbox
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kanban
- Kbd
- Kbd Advanced
- Key Value
- Label
- List
- Listbox
- Map
- Marker
- Marquee
- Mask Input
- Masonry
- Media Player
- Mention
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Pending
- Phone Input
- Pin Input
- Popover
- Portal
- Presence
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Calendar
- Rating
- Relative Time Card
- Resizable
- Responsive Dialog
- Scroll Area
- Scroll Spy
- Scroller
- Segmented Input
- Select
- Selection Toolbar
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Software Purchase Card
- Sonner
- Sortable
- Speed Dial
- Spinner
- Stack
- Stat
- Status
- Stepper
- Stepper Advanced
- Swap
- Switch
- Table
- Tabs
- Tags Input
- Tags Input Advanced
- Textarea
- Time Picker
- Timeline
- Toast
- Toggle
- Toggle Group
- Tooltip
- Tour
- Typography
- Visually Hidden
- Visually Hidden Input
Komponen kode sekali pakai yang mudah diakses, lengkap dengan dukungan salin-tempel.
Installation
pnpm dlx shadcn-vue@latest add input-otpPasang dependensi berikut:
pnpm add vue-input-otpSalin dan tempel kode sumber di GitHub ke project Anda.
Sesuaikan path import dengan struktur project Anda.
Usage
vue
<script setup lang="ts">
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from '@/components/ui/input-otp'
</script>
<template>
<InputOTP v-model="value" :maxlength="6">
<InputOTPGroup>
<InputOTPSlot :index="0" />
<InputOTPSlot :index="1" />
<InputOTPSlot :index="2" />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot :index="3" />
<InputOTPSlot :index="4" />
<InputOTPSlot :index="5" />
</InputOTPGroup>
</InputOTP>
</template>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Examples
Pola
Pakai prop pattern untuk menentukan pola kustom pada input OTP.
vue
<script setup lang="ts">
import { REGEXP_ONLY_DIGITS_AND_CHARS } from 'vue-input-otp'
// ...
</script>
<template>
<InputOTP
maxlength="6"
:pattern="REGEXP_ONLY_DIGITS_AND_CHARS"
>
<InputOTPGroup>
<InputOTPSlot :index="0" />
<!-- ... -->
</InputOTPGroup>
</InputOTP>
</template>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Separator
Pakai komponen <InputOTPSeparator /> untuk menyisipkan pemisah di antara kelompok input.
vue
<script setup lang="ts">
import {
InputOTP,
InputOTPGroup,
InputOTPSeparator,
InputOTPSlot,
} from '@/components/ui/input-otp'
// ...
</script>
<template>
<InputOTP maxlength="4">
<InputOTPGroup>
<InputOTPSlot :index="0" />
<InputOTPSlot :index="1" />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot :index="2" />
<InputOTPSlot :index="3" />
</InputOTPGroup>
</InputOTP>
</template>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Dikendalikan dari Luar
Pakai direktif v-model untuk mengendalikan nilai input dari luar.
Enter your one-time password.
Form
Komponen InputOTP bisa dipakai di dalam form, misalnya bersama VeeValidate.