githubEdit

πŸ§œβ€β™€οΈPolymorphism

Polymorphic components can render as different HTML elements while maintaining their styling and functionality. This is useful for semantic HTML, accessibility, and integrating with routing libraries.

circle-info

For a conceptual overview of polymorphism, see the Polymorphism core concept.

Available polymorphic components

Usage

Use the component prop to change the underlying HTML element:

import { Button } from "@valence-ui/core";

// Renders as an <a> tag
<Button component="a" href="https://example.com">
    External Link
</Button>

// Renders as a React Router Link
<Button component="link" to="/about">
    Internal Link
</Button>

Last updated