Components
Form controls, validation, debounce and interactive widgets you will need on almost every site. Each one is a small, commented Vue file you can read and copy.
Form with validation
The rules live in a single Zod schema. Every field component calls useField(name) and connects itself to the form, so the page only lists the fields.
- Errors show after you leave a field, then update as you type.
- The email field validates while you type, debounced by 500 ms.
- Each field keeps one line for its message, so errors never push the form around.
- Topic is a custom dropdown (Reka UI Select) with full keyboard support.
- Labels,
aria-invalidandaria-describedbyare wired for screen readers. - Checkbox, radio and switch use Reka UI for keyboard support.
Source: app/components/ContactForm.vue, app/components/form/
Debounced search
Debounce delays a function until the user stops triggering it. Type quickly and compare the two counters: many keystrokes, one search.
- Use it for search boxes, autocomplete and live validation.
- Always call
.cancel()when the component unmounts. - Need “at most once every X ms” instead? That is
throttle.
Source: app/components/DebouncedSearch.vue
- Keystrokes
- 0
- Searches run
- 0
- Status
- 21 results
useAsyncData()useFetch()useLazyFetch()useState()useCookie()useHead()useSeoMeta()useRoute()useRouter()useRuntimeConfig()useNuxtApp()useError()useRequestHeaders()useRequestURL()useAppConfig()useId()useLoadingIndicator()usePreviewMode()useRequestEvent()useResponseHeader()useRouteAnnouncer()
Accordion
Source: app/components/ui/UiAccordion.vue
Tabs
npm install reka-ui vee-validate @vee-validate/zod zod lodash-es
Use the arrow keys to move between tabs. Source: app/components/ui/UiTabs.vue
Dialog
Source: app/components/ui/UiDialog.vue