@fordodo00/vue-inputs
Customizable, accessible, SSR-safe form inputs for Vue 3, Nuxt 3 and Nuxt 4.
Published under the @fordodo00 npm user scope.
- 50 independent, tree-shakeable components (named exports). Importing a text input does not pull in maps, date pickers, the rich text editor or phone metadata.
- Restyle the components after installation at three levels: global theme, per-component props/defaults, and
ui slot classes, CSS variables, slots or unstyled mode.
- Endpoint-first
UiAsyncSelect: pass an endpoint and mapping props. You don't need to write a request function.
- One file engine with three modes:
local (native File), attachment (with optional modelName/modelId) and upload.
- Headless UI Listbox/Switch, VueDatePicker, libphonenumber-js, OpenStreetMap + Leaflet.
- English/Arabic, LTR/RTL, light/dark/auto, keyboard accessible, optional VeeValidate integration.
Install
pnpm add @fordodo00/vue-inputs
# optional, only if you use the VeeValidate integration
pnpm add vee-validate
Vue ^3.5 is a peer dependency.
Vue 3
import { createApp } from 'vue'
import { createVueInputs } from '@fordodo00/vue-inputs'
import '@fordodo00/vue-inputs/styles.css'
import '@fordodo00/vue-inputs/date.css' // only if you use date/time components
import '@fordodo00/vue-inputs/map.css' // only if you use UiMapInput / UiAddressInput with a map
import App from './App.vue'
createApp(App)
.use(
createVueInputs({
theme: { primary: '#2563eb', radius: '10px', mode: 'auto', components: { UiSelect: { variant: 'filled' } } },
locale: 'ar',
direction: 'rtl',
api: { baseURL: '/api', getHeaders: () => ({ Authorization: `Bearer ${getAccessToken()}` }) }
})
)
.mount('#app')
The plugin is optional. Components work standalone with defaults:
<script setup>
import { UiTextInput } from '@fordodo00/vue-inputs'
</script>
Nuxt 3 / Nuxt 4
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@fordodo00/vue-inputs/nuxt'],
vueInputs: {
dateCss: true,
mapCss: true,
config: { locale: 'en', theme: { primary: '#7c3aed' }, api: { baseURL: '/api' } }
}
})
Components are auto-imported, and you can still use named imports. Options under config must be serializable. When you need functions such as api.getHeaders, set plugin: false and install your own Nuxt plugin:
// plugins/vue-inputs.ts
import { createVueInputs } from '@fordodo00/vue-inputs'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(createVueInputs({ api: { baseURL: '/api', getHeaders: () => ({ Authorization: `Bearer ${useCookie('token').value}` }) } }))
})
Examples
<UiAsyncSelect
v-model="form.user_id"
label="User"
endpoint="/users"
items-path="data.items"
total-path="data.total"
option-label="full_name"
option-value="id"
resolve-endpoint="/users/:id"
searchable
paginated
clearable
/>
<UiFileInput
v-model="form.attachmentId"
label="Attachment"
mode="attachment"
endpoint="/attachments"
model-name="Employee"
:model-id="employeeId"
/>
<UiPhoneInput v-model="form.phone" label="Phone" default-country="EG" :preferred-countries="['EG', 'SA']" />
<UiDateInput v-model="form.birthDate" label="Birth date" :max-date="today" />
Value contracts (summary)
| Component |
Value |
| Text inputs |
string (empty → '', or :empty-value="null") |
| Number / Decimal / Currency / Percentage |
number \| null (0 is a value) |
| Checkbox / Switch |
boolean (or true-value/false-value) |
| Select / AsyncSelect / RadioGroup |
option value or null; multiple → array ([]) |
| Phone |
E.164 string ('+201012345678') or null |
| Date / Time / Month / Year |
'YYYY-MM-DD' / 'HH:mm' / 'YYYY-MM' / number |
| DateRange |
{ start, end } |
| DateTime |
ISO UTC string by default (value-format: iso | local | timestamp | date) |
| File (local) |
File \| null / File[] |
| File (attachment) |
attachment id (after a successful upload only) |
| File (upload) |
response object (or return-as="url" / "id") |
| Map |
{ lat, lng, address? } \| null |
| Range |
[start, end] |
Full usage guide: USAGE.md covers every component (examples, value contracts, prop/event tables), configuration, theming, the HTTP engine, files, VeeValidate, SSR and troubleshooting. An interactive docs site lives in apps/docs in the repository (pnpm dev:docs).
Styling
styles.css is precompiled and namespaced (vi-*). It does not include a global reset or Tailwind Preflight, and you don't need to add anything to your Tailwind content scan.
- Tokens are plain CSS variables (
--vi-color-primary, --vi-control-radius, --vi-control-height-md, --vi-font-family, --vi-focus-ring-color, …).
- Tailwind 4 users who want utilities in
ui to override library styles can import styles.layered.css (wrapped in @layer vue-inputs) and declare @layer theme, base, vue-inputs, components, utilities;.
SSR
No browser API is touched at import time. VueDatePicker, Leaflet and the image cropper load lazily on the client behind identical SSR placeholders. Endpoint-driven components only request data in the browser, and the request cache is per app instance, so nothing is shared between SSR requests.
License
MIT