Skip to main content
v7

Polymorph

A polymorphic wrapper that renders as any HTML element via the `as` prop while forwarding all native props.

Package@g4rcez/componentsSectionPrimitives

Examples

Default Span

Without an `as` prop, Polymorph renders as a span.

Default (span)
I am a span

Custom Element

Pass `as` to change the rendered element. All native props of the target element are accepted.

As different elements

Heading 1

Paragraph text

Section block

As Interactive Element

Polymorph as a button, forwarding all button-specific props including onClick and disabled.

As button

When to use Polymorph

Use when

You need the documented Polymorph interaction or presentation in a product workflow.

Avoid when

A native HTML element already provides the Polymorph behavior you need.

Accessibility

Keep the Polymorph labeled and use its documented keyboard interaction. The component preserves visible focus and communicates state without relying on color alone.