ElementRequired

Basic Usage

<ElementRequired> component can be used in a <Vueform> component:

Properties

Properties include data, computed and inject properties of the component. You can use them by reaching the element's Vue component instance via form$'s el$(path) method or directly via this in options API or el$ in Composition API.

visible

  • Type: boolean
  • Group: computed

Whether the required sign (*) should be visible.

Size

  • Type: string
  • Group: inject

The size of the component.

View

  • Type: string
  • Group: computed

The name of the resolved view for the component. This one should be used to determine the component's view in class functions.

template

  • Type: object
  • Group: computed

The component's template.

classes

  • Type: object
  • Group: computed

The component's classes.

theme

  • Type: object
  • Group: inject

The global theme object, which contains all the default templates and classes.

form$

  • Type: Vueform
  • Group: inject

The root form's component.

el$

  • Type: VueformElement
  • Group: inject

The parent element's component.

Slots

Slots can be used inline or in slots option object when used in schema:

vue
<template>
  <Vueform>
    <ElementRequired ... >
      <template #{slot-name}="scope">
        <!-- ... --->
      </template>
    </ElementRequired>
  </Vueform>
</template>
vue
<script>
import { Vueform, useVueform } from '@vueform/vueform'

export default {
  mixins: [Vueform],
  setup: useVueform,
  data: () => ({
    vueform: {
      schema: {
        element: {
          type: 'element-required',
          slots: {
            {slotName}: // implementation
          }
        }
      }
    }
  })
}
</script>

default

👋 Hire Vueform team for form customizations and developmentLearn more