Skip to content

NumberProp

Number property definition for numeric-valued props, whether inferred from a TEXT code-only prop or from a VARIANT whose options are all numbers.

Path

component-api:props.<prop>

Members

MemberTypeRequiredDescription
type'number'YesThe discriminator — always 'number'.
defaultnumberNoDefault numeric value.
enumnumber[]NoThe closed set of accepted values, when the source enumerates them rather than leaving the range open.
nullablebooleanNoWhether this prop accepts a null value.
examplesnumber[]NoSample numeric values demonstrating typical content for this prop
$extensionsPropExtensionsNoPlatform provenance under reverse-domain keys.

Examples

type: number
default: 1
type: number
default: 2
examples: [2]
$extensions:
com.figma:
type: TEXT
source:
kind: codeOnlyProp
layer: headingLevel

Platform bindings

Figma

Disposition: bound · Realised by: TEXT default or all-numeric VARIANT options, under platforms.figma.inferNumberProps“

Rules: variantAxes — with boolean, enum · numberInference — with string

Opt-in inference (ADR-029). A TEXT property whose default passes the numeric guard becomes a NumberProp; a VARIANT whose every option is numeric becomes a NumberProp carrying the options as enum (ADR-072). With the convention off, both stay strings.

CSS

Disposition: bound · Realised by: Css

Rules: propsToSelectors — with boolean, enum, object

A number prop with a closed enum is a variant axis and selects like an enum, on the numeric spelling. An open-valued number is content and emits nothing.

React

Disposition: bound · Realised by: a number member of the Props interface

Emitted as a numeric expression — count={1430} — wherever a configuration carries it, keyed to the declared type rather than to how the text looks: the same digits against a string prop are content. A closed enum of numbers selects like an enum does.

Web Components

Disposition: bound · Realised by: a number member of the element’s contract

Shared contract derivation. A closed enum of numbers reflects and selects like an enum does, on the numeric spelling.

Decisions

  • ADR-014 — Add examples to TextProp and IconProp, deprecate default
  • ADR-015 — Resolve AnyProp oneOf schema violation between TextProp and IconProp
  • ADR-019 — Allow null in StringProp.default
  • ADR-029 — NumberProp — Numeric Property Type
  • ADR-105 — Type–Schema Parity for Overlapping Prop Unions
  • ADR-121 — A unit-interval style type for opacity and cornerSmoothing
  • ADR-125 — Instance-example orientation

Rules

RuleStatement
DSPEC-12null is meaningful only under a nullable prop

Source

FormatFile
JSON Schemapackages/schema/schema/component.schema.json
TypeScriptpackages/schema/types/Props.ts
Specification§4.2, §11