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
| Member | Type | Required | Description |
|---|---|---|---|
type | 'number' | Yes | The discriminator — always 'number'. |
default | number | No | Default numeric value. |
enum | number[] | No | The closed set of accepted values, when the source enumerates them rather than leaving the range open. |
nullable | boolean | No | Whether this prop accepts a null value. |
examples | number[] | No | Sample numeric values demonstrating typical content for this prop |
$extensions | PropExtensions | No | Platform provenance under reverse-domain keys. |
Examples
type: numberdefault: 1type: numberdefault: 2examples: [2]$extensions: com.figma: type: TEXT source: kind: codeOnlyProp layer: headingLevelPlatform 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
examplestoTextPropandIconProp, deprecatedefault - ADR-015 — Resolve
AnyProponeOfschema violation betweenTextPropandIconProp - 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
opacityandcornerSmoothing - ADR-125 — Instance-example orientation
Rules
| Rule | Statement |
|---|---|
| DSPEC-12 | null is meaningful only under a nullable prop |
Source
| Format | File |
|---|---|
| JSON Schema | packages/schema/schema/component.schema.json |
| TypeScript | packages/schema/types/Props.ts |
| Specification | §4.2, §11 |