ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[object Object] in subheading

Open brampurnot opened this issue 5 years ago • 2 comments

Hi all,

I'm trying to embed a component in the subheading of a card. The component is basically to format a number and more information can be found here: https://www.npmjs.com/package/react-number-format

When I try to do this, I'm seeing [object Object] on the UI. This the example code: ` <Card subheading={<NumberFormat value={totalProducts} displayType={'scrapd'} thousandSeparator={true} />}

`

And here is what I see on the UI: Screenshot 2021-04-10 at 14 04 19

Any reason why this is not supported or is this a bug?

Bram

brampurnot avatar Apr 10 '21 12:04 brampurnot

Hi @brampurnot

currently the subheading prop is only accepting strings as value (documentation), React nodes or any other elements are not supported.

Since the Card component is developed by the ui5-webcomponents team, I'll transfer this issue to their repo so they can respond to your request as well.

Lukas742 avatar Apr 12 '21 07:04 Lukas742

Hi @brampurnot

UI5 Web Components will cast anything that is passed to a string property unless a string is passed, so basically you can't bind an object to a string property.

As much as I can read from the docs of react-number-format, you can bind to the value property of the object that you already have(the value property is String, so everything should be fine)

fifoosid avatar Apr 12 '21 08:04 fifoosid