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 }}Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends VexResourceSlug = VexResourceSlug
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Example
Section titled “Example”// Minimal — label is inferred from the key ("Price")price: number()
// Required quantity with a minimum of 1 and a database indexquantity: number({ required: true, min: 1, index: "by_quantity" })
// An int64 counter — bigint everywhereviewCount: 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)