Skip to content

Field

Last updated 6 Nov 2026

NbField is a labeled row: a label and a control sharing one grid. A stack of NbFields lines up on a single spine automatically, with no per-field CSS, which makes it the building block of an inspector or a settings panel. Wrap any control and it falls into place.

Basic ​

vue
<template>
  <NbField label="Name"><NbTextInput v-model="name" size="sm" /></NbField>
  <NbField label="Channel"
    ><NbSelect v-model="ch" :options="channels" size="sm"
  /></NbField>
</template>

Every field reads --nb-field-label-width, so fields share one label column. Set it on the container to shift the whole spine:

css
.my-panel {
  --nb-field-label-width: 8rem;
}

Label association ​

The default slot receives a generated id; bind it to your control so the label points at it (or pass your own via labelFor):

vue
<NbField label="Name" v-slot="{ id }">
  <NbTextInput :id="id" v-model="name" />
</NbField>

Mixed controls align ​

Every form control puts the same vertical gap between its label and its field, so a row that mixes control types lines its field tops up to the pixel. The gap is one token, --nb-field-label-gap, shared by NbTextInput, NbDatePicker, NbSelect, NbNumberInput, NbSlider and NbField's stack mode. It holds with or without a helper line.

With a helper or error line under one of them, the field tops still align. The message only adds height below the field:

To tighten or loosen every control at once, override the token on a container:

css
.my-form {
  --nb-field-label-gap: 4px;
}

Props ​

PropTypeDefaultDescription
labelstringundefinedLabel text. Omit and use the #label slot for a custom label.
hintstringundefinedHelper text shown under the control, muted.
orientation'row' | 'stack''row'row: label beside the control on the shared spine. stack: label on its own line, control below.
align'center' | 'start''center'Vertical alignment of the label against the control. start top-aligns against a tall control.
control'fill' | 'fit''fill'fill: control fills the value column. fit: control hugs its content and the label runs wide.
labelForstringundefinedId of the control the label points at. Defaults to an auto-generated id, also exposed to the slot.

Slots ​

SlotDescription
defaultThe control. Receives { id, describedby }: bind them to your control for the label and the hint.
labelCustom label content, replacing the label prop.
hintCustom hint content, replacing the hint prop.