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
| Member | Type | Required | Description |
|---|---|---|---|
type | 'string' | Yes | The discriminator — always 'string'. |
default | string · null | No | Deprecated — use examples for demo content (ADR-014). |
nullable | boolean | No | Whether this prop accepts a null value. |
examples | string[] | No | Sample values demonstrating typical content for this prop |
$extensions | PropExtensions | No | Platform provenance under reverse-domain keys. |
Examples
type: stringdefault: Savenullable: falseexamples: [Save, Submit, Continue]type: stringnullable: truedefault: nullexamples: [New]$extensions: com.figma: visibilityProp: Badge visiblePlatform 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
examplestoTextPropandIconProp, deprecatedefault - ADR-015 — Resolve
AnyProponeOfschema violation betweenTextPropandIconProp - ADR-019 — Allow null in StringProp.default
- ADR-065 — Document the
nullableDefault and AddNumberProp.nullable - ADR-105 — Type–Schema Parity for Overlapping Prop Unions
- 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 |