Number Field


The number field represents a number input.

tinacms-number-field

Options

interface NumberConfig extends FieldConfig {
  component: 'number'
  name: string
  label?: string
  description?: string
  step?: string | number
}
OptionDescription
componentThe name of the plugin component. Always 'number'.
nameThe path to some value in the data being edited.
labelA human readable label for the field. Defaults to the name. (Optional)
descriptionDescription that expands on the purpose of the field or prompts a specific action. (Optional)
stepThe interval used when using the up and down arrows to adjust the value. (Optional)

This interfaces only shows the keys unique to the number field.

Visit the Field Config docs for a complete list of options.

Example: A Sorting Weight

Below is an example of how a number field could be used to edit a weight value used for sorting blog posts.

const BlogPostForm = {
  fields: [
    {
      component: 'number',
      name: 'weight',
      label: 'Weight',
      description: 'Enter a weight for post sorting',
      step: 1,
    },
    // ...
  ],
}