Skip to content

NumberFieldInput

NumberFieldInput<TCollectionSlug, TFieldKey, TFieldMeta> = Float64NumberFieldInput<TCollectionSlug, TFieldKey, TFieldMeta> | Int64NumberFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>

Defined in: packages/core/src/fields/number/types.ts:149

Configuration input for a number() field.

Number fields store numeric values — prices, quantities, ratings, ages, counts, etc. By default they store a v.float64(); schema: { validator: "int64" } stores a native bigint instead (v.int64()), typing min/max/defaultValue/validate as bigint. All properties are optional; unset properties fall back to the defaults listed below.

Defaults applied by number():

{
type: "number",
label: "", // inferred from the field key by defineCollection
required: false, // field is optional by default
admin: {
hidden: false, // visible in the admin form
readOnly: false, // editable by default
position: "main", // placed in the main content column, not the sidebar
width: "100%", // spans the full form width, not half
cellAlignment: "left", // value aligned left in the data table column
}
}

TCollectionSlug extends VexResourceSlug = VexResourceSlug

TFieldKey extends string = never

TFieldMeta extends object = { }

// Minimal — label is inferred from the key ("Price")
price: number()
// Required quantity with a minimum of 1 and a database index
quantity: number({ required: true, min: 1, index: "by_quantity" })
// An int64 counter — bigint everywhere
viewCount: number({ schema: { validator: "int64" }, min: 0n })
  • NumberField for the resolved type after defaults are applied
  • number for the config function that applies defaults
  • BaseFieldInput for shared properties (label, description, required, admin, index, searchIndex)