Input Group

Storybook

Input Groups are convenience components for a grouping of related inputs. While each input within the group could be independent, the v-model on the group provides a convenient interface for determining the current state of the group.

Preview

Default

Input Groups are typically paired with a legend which identifies the group. If no legend is provided then it is expected that an aria-label will be given in order to provide an invisible label to screen readers. Each Input Group should contain one or more inputs which users can interact with.

Model

The Vue model can have one of the following types [String, Number, Boolean, Object]:

// default = null
const value = 'some value';

The Vue model is dependant on the child component(s) implementing the provided groupContext and calling the provided setGroupValue method which will handle updating the provided groupContext and Vue model in the parent.

import {
  DtInputMixin,
  DtGroupableInputMixin,
} from '@dialpad/dialtone/vue';

export default {
  name: 'MyInputElement',

  mixins: [DtInputMixin, DtGroupableInputMixin],

  computed: {
    groupValue () {
      return this.groupContext?.value;
    },

    inputListeners () {
      return {
        change: event => this.emitValue(event.target.value),
      };
    },
  },

  watch: {
    groupValue: {
      immediate: true,
      handler (newGroupValue) {
        if (this.hasGroup) {
          // update internal value when the input group value changes
          this.internalChecked = newGroupValue === this.value;
        }
      },
    },
  },

  methods: {
    emitValue (value) {
      if (value !== this.groupValue) {
        // update provided value if injected
        this.setGroupValue(value);

        this.$emit('input', value);
      }
    },
  },
};

Variants

With Legend

With Slotted Legend

Disabled

With Validation Messages

With Validation Messages Hidden

Extending

If your input(s) require additional logic in order to be grouped then you can extend the Input Group using extends in your Vue SFC.

Example

<script>
import { DtInputGroup } from '@dialpad/dialtone/vue';

export default {
  name: "MyComponent",
  extends: DtInputGroup,
  ...
};
</script>

Vue API

Slots

Name
Description
default

slot for Input Group Components

legend

slot for Input Group Legend

Props

Name
Description
Default
name
required

The name of the input group

Type: string
dataQaGroup

A data qa tag for the input group

Type: string
'input-group'
dataQaGroupLegend

A data qa tag for the input group legend

Type: string
'input-group-legend'
dataQaGroupMessages

A data qa tag for the input group messages

Type: string
'input-group-messages'
disabled

Disables the input group

Type: boolean
Values: truefalse
false
id

The id of the input group

Type: string
function() { return getUniqueString(); }
legend

The legend of the input group

Type: string
''
legendChildProps

A set of props that are passed into the legend element

Type: object
{}
legendClass

Used to customize the legend element

Type: string|array|object
''
messages

Validation messages

Type: array
[]
messagesChildProps

A set of props that are passed into the messages container

Type: object
{}
messagesClass

Used to customize the messages container

Type: string|array|object
''
showMessages

Show validation messages

Type: boolean
Values: truefalse
true
value

The value of the input group

Type: string|number|boolean|object
null

Events

Name
Description
input

Native input event

Type: KeyboardEvent
Input Group documentation last updated Thursday, June 11, 2026