Skip to content

StringProp

String property definition for text content, glyph/instance swap, or other string-valued props. A StringProp is distinguished from an EnumProp by the absence of enum — the two share type: string, and the closed list is what separates a value set the library enumerates from one it leaves open.

Path

component-api:props.<prop>

Members

MemberTypeRequiredDescription
type'string'YesThe discriminator — always 'string'.
defaultstring · nullNoDeprecated — use examples for demo content (ADR-014).
nullablebooleanNoWhether this prop accepts a null value.
examplesstring[]NoSample values demonstrating typical content for this prop
$extensionsPropExtensionsNoPlatform provenance under reverse-domain keys.

Examples

type: string
default: Save
nullable: false
examples: [Save, Submit, Continue]
type: string
nullable: true
default: null
examples: [New]
$extensions:
com.figma:
visibilityProp: Badge visible

Platform bindings

Figma

Disposition: bound · Realised by: ComponentPropertyDefinitions (TEXT or INSTANCE_SWAP)

Rules: numberInference — with number

TEXT and INSTANCE_SWAP both collapse to string; the Figma property type survives in $extensions['com.figma'].type. An INSTANCE_SWAP default resolves the component id to a name, reduced to the glyph name where the glyphs convention identifies one (ADR-103). The read default lands in examples, never default (ADR-014). Render re-derives the property type from where the prop is bound: content → TEXT, instanceOf → INSTANCE_SWAP.

CSS

Disposition: unsupported · Realised by: —

A string prop is content. Nothing is emitted for it; the stylesheet styles the element that carries it, never the value.

React

Disposition: bound · Realised by: a string member of the Props interface, nullable-widened with null

Widened to admit null by the nullability rule: absent nullable means nullable for an open-valued kind (ADR-065). examples feed stories and composed instances; they never become a contract default.

Web Components

Disposition: bound · Realised by: a string member of the element’s contract, nullable-widened with null

Widened to admit null by the shared nullability rule (ADR-065). examples feed stories; they never become a contract default.

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-065 — Document the nullable Default and Add NumberProp.nullable
  • ADR-105 — Type–Schema Parity for Overlapping Prop Unions
  • 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