@dynamicforms/vuetify-inputs

中文文档
0.15.6发布于 2026/11/11MITTypeScriptESM + CJS零依赖近 30 天下载 3463

Vuetify input components with guaranteed visual consistency across all form fields — unified density/variant system, globally configurable, with inline mode for table cells. Built for @dynamicforms/vue-forms.

原始使用文档
文档目录10 节
  1. Introduction
  2. Design Goals
  3. What matters most
  4. Everything else it does
  5. Installation
  6. Basic Usage Example
  7. Documentation
  8. Available Components
  9. TypeScript Support
  10. License

@dynamicforms/vuetify-inputs

Vuetify input components with guaranteed visual consistency across all form fields — unified density/variant system, globally configurable, with inline mode for table cells. Built for @dynamicforms/vue-forms.

Introduction

@dynamicforms/vuetify-inputs provides input components for data entry, built so that every one of them matches every other.

Hand a component an element of @dynamicforms/vue-forms and that element owns the value, the validation, the enabled state and the visibility, and the component renders what it holds. Every component also works with a plain v-model, or with no binding. The density and variant system and the inline mode for table cells are the same in all three cases.

Design Goals

The primary goal of this library is visual consistency: every input component should look and behave the same regardless of which component is used or where it appears in the application. This means that mixing df-input, df-select, df-checkbox, df-date-time, and others on the same form row should produce a coherent, aligned result without any per-component tweaking.

To achieve this, the library introduces a density/variant system that applies uniformly to all components:

  • Density controls the vertical compactness of a component and can be set globally, injected per-section, or overridden per-component. Supported values are default, comfortable, compact, and inline.
  • Variant controls the visual style (e.g. outlined, underlined, filled, solo, …) and follows the same hierarchy.
  • The inline density is a custom extension beyond standard Vuetify — it strips labels and decorations so components render cleanly inside table cells.

Global defaults can be set once at application startup via VuetifyInputsSettings and propagated down through Vue's provide/inject, so the entire application can switch density or variant with a single change.

The density example in the documentation demonstrates all components rendered side-by-side across every density and variant combination to verify alignment and consistent appearance.

What matters most

  • Every field matches every other: one shared base, so a row mixing a text field, a select, a checkbox and a date picker comes out aligned with no per-component tweaking
  • A density that fits a table cell: default, comfortable and compact are Vuetify's; inline is this library's own, and strips a field of its decoration until it fits inside a cell
  • Set the look once, override anywhere: density and variant are read from the prop, then the field, then a provide from any ancestor, then the plugin defaults — most specific first
  • The field carries its own presentation: a @dynamicforms/vue-forms field holds the label, hint, placeholder, css class, density and variant it is drawn with, so a form declared in code needs no presentation attributes on the tags that draw it

Everything else it does

  • Twelve components: df-input, df-text-area, df-select, df-checkbox, df-color, df-date-time, df-file, df-image, df-rtf-editor, df-actions, df-input-hint and df-input-group
  • A control, a v-model, or neither: a bound element owns the value, validity, touched, enabled and visibility; v-model reports changes to the parent; neither keeps the value internally
  • Errors, hints and help text in one row, rendered through the library's own MessagesWidget; an error renders as the plain text, markdown or component the application's errorText setting returns for its code and params, or as its English detail, and is shown by one rule an application can replace — the server's at once, every other once the field is touched
  • Labels with icons, markdown, HTML or a component, through the Label class, MdString, HtmlString and SimpleComponentDef
  • Visibility — 'full', 'invisible', 'hidden', 'suppress' — and enablement that follows the containing section
  • passthroughAttrs: any prop of the underlying Vuetify component, without this library declaring it
  • Actions: the Action class with render options, defaultConfirm / defaultReject, the ready-made close/yes/no factories, and per-breakpoint render options from xs to xl
  • Selection: static choices or an async fetchChoices, single or multiple, chips with icons, free values with allowTags
  • Uploads: a FileComms object with upload progress, delete and a periodic touch
  • Rich text: TipTap with a Vuetify toolbar, inside the same field frame as every other input
  • Localisable: translateStrings(), or the translate setting per app, connects the library's own strings, including every RTF editor toolbar label and <df-image>/<df-file>'s upload and download prompts, to the application's translation function; the errorText setting translates errors; DateTimeLocaleConfig, or the dateTimeLocale setting per app, sets the date-fns locale dates are formatted and parsed with — see the localisation example for every key and a worked example
  • TypeScript: every component's props are an exported interface, and the definitions ship with the build

Installation

npm install @dynamicforms/vuetify-inputs

In your main.ts

import { DynamicFormsInputs } from '@dynamicforms/vuetify-inputs';
import '@dynamicforms/vuetify-inputs/styles.css';

...
const app = createApp(MyApp);
app.use(router);
app.use(vuetify);
// registers the library for use and optionally inputs globally
app.use(DynamicFormsInputs, { registerComponents: true, registerVuetifyComponents: false });

Basic Usage Example

The library offers various components, including:

<template>
  <div>
    <df-select
      :control="form.fields.country"
      :choices="countries"
      label="Select Country"
    />
    
    <df-text-area
      :control="form.fields.description"
      label="Description"
      :rows="5"
      :max-rows="10"
    />
    
    <df-file
      :control="form.fields.document"
      :comms="fileComms"
      label="Upload Document"
    />
  </div>
</template>

<script setup>
import { Group, Field } from '@dynamicforms/vue-forms';
import { DfSelect, DfTextArea, DfFile } from '@dynamicforms/vuetify-inputs';

// Create a form with fields
const form = new Group({
  country: new Field({ value: null }),
  description: new Field({ value: '' }),
  document: new Field({ value: null })
});

// Define options for the select field
const countries = [
  { id: 'us', text: 'United States' },
  { id: 'ca', text: 'Canada' },
  { id: 'uk', text: 'United Kingdom' },
  // more countries...
];

// Communication for file field
const fileComms = {
  upload: async (file, progressCallback) => {
    // Upload implementation
  },
  delete: async (fileId) => {
    // Delete implementation
  },
  touch: async (fileId) => {
    // Touch implementation
  }
};
</script>

Documentation

Detailed documentation is available at https://docs.velis.si/dynamicforms/vuetify-inputs.

Available Components

  • InputBase: The base component for all input elements
  • DfLabel: Renders a label - plain text, markdown, HTML or a component, with an icon - the way every input renders its own
  • df-actions: An actions group.
  • df-checkbox: A checkbox component.
  • df-color: A color input.
  • df-date-time: A date and time selection component with configurable format and type.
  • df-file: A file upload component with progress indication
  • df-image: An image upload with a preview, drag and drop and paste
  • df-input: A general value input.
  • df-input-group: One field's frame, label and message row around several inputs, e.g. a set of checkboxes
  • df-input-hint: Renders a field's or a group's errors, falling back to its hint text.
  • df-rtf-editor: A RTF editor input.
  • df-select: A selection component supporting static or dynamic options, multiple selection, and tagging
  • df-text-area: A textarea component with configurable rows and validation

TypeScript Support

The library is written in TypeScript and provides full type definitions for all components and interfaces.

License

MIT

版本与发布记录

@dynamicforms/vuetify-inputs 共发布 98 个版本,首次发布于 2025/04/18;过去 12 个月发布了 46 个版本。

版本发布日期距今
0.15.6latest2026/11/112 天前
0.15.52026/11/0310 天前
0.15.42026/10/3113 天前
0.15.32026/10/2618 天前
0.15.22026/10/2420 天前
0.15.12026/10/2123 天前

关于 @dynamicforms/vuetify-inputs 的常见问题

@dynamicforms/vuetify-inputs 是什么?

Vuetify input components with guaranteed visual consistency across all form fields — unified density/variant system, globally configurable, with inline mode for table cells. Built for @dynamicforms/vue-forms.

如何安装 @dynamicforms/vuetify-inputs?

在项目目录运行 npm install @dynamicforms/vuetify-inputs,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.5.2)、vuetify(^3.9)、date-fns(^4.1.0)、@mdi/font(^7.4.47)、lodash-es(^4.17.12)、@tiptap/pm(^3.30.2)、@tiptap/core(^3.30.2)、@tiptap/vue-3(^3.30.2)、vue-cached-icon(^3.2.0)、@tiptap/starter-kit(^3.30.2)、vue-markdown-render(^2.2.1)、@tiptap/extension-link(^3.30.2)、@dynamicforms/vue-forms(^3.0.0-alpha.3)、@tiptap/extension-image(^3.30.2)、@tiptap/extension-table(^3.30.2)、@dynamicforms/translatable(^0.3.0)、@tiptap/extension-table-row(^3.30.2)、@tiptap/extension-table-cell(^3.30.2)、@tiptap/extension-text-align(^3.30.2)、@tiptap/extension-placeholder(^3.30.2)、@tiptap/extension-table-header(^3.30.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dynamicforms/vuetify-inputs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dynamicforms/vuetify-inputs 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dynamicforms/vuetify-inputs 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dynamicforms/vuetify-inputs 可以商用吗?

@dynamicforms/vuetify-inputs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dynamicforms/vuetify-inputs 的下载量有多少?

根据 npm 官方下载统计,@dynamicforms/vuetify-inputs 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,463 次,日均约 115 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dynamicforms/vuetify-inputs 还在维护吗?

最新版本 0.15.6 发布于 2026/11/11(2 天前);至今共发布 98 个版本,其中过去 12 个月发布了 46 个;首次发布于 2025/04/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。