Skip to content

Text accepts a size prop but silently discards it #3615

Description

@josephfarina

Summary

Text declares a size?: TextSize prop, documented as an explicit font-size override:

/**
 * Explicit font size override. When set, overrides the size from `type`
 * ...
 * ⚠️ Lint rule: Prefer using `type` alone. Use `size` only for custom
 * UI elements that need explicit size control (metrics, callouts).
 */
size?: TextSize;

But the implementation destructures it away and never applies it:

export function Text({
  type = 'body',
  size: _size,   // <-- discarded; never referenced again
  color,
  ...

Rendered font size comes exclusively from type — no size class, style, or data attribute is emitted (themeProps('text', {type, color}) doesn't include it either).

Repro

<Text type="code" size="2xs">should be tiny</Text>
<Text type="code">same size as the line above</Text>

Both render at --text-code-size. Version: @astryxdesign/core 0.1.2.

Expected

Either of:

  • size actually overrides the type's font size, per its JSDoc; or
  • the prop is removed (or @deprecated + lint-flagged) so TypeScript surfaces the mistake.

Why it matters

The silent no-op is the worst of both: it type-checks, it's documented as working, and codebases accumulate dead size= props while everyone tunes their UI around what happens to render. We found dozens of no-op usages in our app once we noticed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions