Integer

ReferenceSchema API

s.int()

A whole number, with steps, bounds and a slider if you want one.

Use it for

  • Counts, columns and sizes
  • Percentages edited with a slider

Reference

s.int()

schema

A whole number. The value is an ordinary number; s.int() adds the rule that it has no decimals.

In Val Studio

Methods

.min(n) / .max(n)

The smallest and largest value allowed.

.step(n)

Only multiples of n are allowed.

.render({ as: "slider", min, max })

Edit the value with a slider instead of a number box.

Example

Columns and opacity

TypeScript
const schema = s.object({
  columns: s.int().min(1).max(6),
  opacity: s.int().min(0).max(100).step(5).render({
    as: "slider",
    min: 0,
    max: 100,
  }),
});
See alsonumber