Nihilistic Pool Man

    @s-ui/react-primitive-polymorphic-element

    1.2.0 • Public • Published

    PolymorphicElement

    Render a basic polymorphic element capable of rendering a specified html tag or component when passed as a property.

    Installation

    $ npm install @s-ui/react-primitive-polymorphic-element

    Usage

    Basic usage

    Import package and use the component

    import PolymorphicElement from 'components/primitive/polymorphicElement/lib/index.js'
    
    function Component() {}
    
    return (
    <>
      <PolymorphicElement as="div"/>
      <PolymorphicElement as="h1"/>
      <PolymorphicElement as={Component}/>
    </>
    )

    Properties

    Property Type Default Description
    as string | function 'span' Render the passed value as the correspondent HTML tag or the component if a function is passed.

    Find full description and more examples in the demo page.

    Keywords

    none

    Install

    npm i @s-ui/react-primitive-polymorphic-element

    DownloadsWeekly Downloads

    791

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    2.11 kB

    Total Files

    4

    Last publish

    Collaborators

    • schibstedspain