salla-metadata
Shows the custom fields (metadata) a merchant has filled in for a product, grouped into titled sections.
Shows the custom fields (metadata) a merchant has filled in for a product, grouped into titled sections.
Use it on a product page to list extra specifications. It renders nothing unless the store has the
custom-fields feature enabled and there is data to show. Field types file render a download link,
url a link, date is formatted as DD/MM/YYYY; other types are shown as plain text.
On the single product page, entity-id is taken from the page automatically when not set.
Use it
In HTML or JSX, use the tag <salla-metadata> with the Attribute names below. In React, the wrapper takes the Property names (camelCase).
import { SallaMetadata } from '@salla.sa/twilight-components-react/metadata';Client-only. On the server this wrapper renders a placeholder (a skeleton, or nothing), and the real component mounts in the browser. Do not rely on it for content that search engines must see.
Example
import { SallaMetadata } from '@salla.sa/twilight-components-react/metadata';
export function Example() {
return (
<SallaMetadata entity="product" entityId="123456" />
);
}Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
entity | entity | The entity type to fetch custom-field values for. Defaults to "product". | string | 'product' |
entityId | entity-id | The id of the entity (for a product, the product id) whose custom fields are fetched. Accepts a number, a string, or an array of numbers (a JSON string such as "[1,2]" is parsed into an array). If omitted on a single product page, the current page id is used; elsewhere nothing is rendered. | number | number[] | string |