woocommerce/packages/js/components/src/woo-product-section-item
louwie17 aec4dfd3bd
Update product editor package (#36830)
* Add missing dev packages to product-editor package

* Create components folder for organization

* Move product field, section and tab slots over to product-editor package

* Move use of product slot fills to product-editor package

* Sync dependencies

* Add changelogs

* Update README's and add constant for default values

* Update README's in product-editor package
2023-02-24 09:37:53 -04:00
..
README.md Update product editor package (#36830) 2023-02-24 09:37:53 -04:00
index.ts Adding WooProductSectionItem slotfill (#36331) 2023-01-11 10:00:20 -08:00
woo-product-section-item.tsx Update product editor package (#36830) 2023-02-24 09:37:53 -04:00

README.md

WooProductSectionItem Slot & Fill

A Slotfill component that will allow you to add a new section to the product editor.

Usage

<WooProductSectionItem id={ key } location="tab/general" order={ 2 } pluginId="test-plugin" >
  { () => {
    return (
      <ProductSectionLayout
        title={ __( 'Product test section', 'woocommerce' ) }
        description={ __(
          'In this area you can describe the section.',
          'woocommerce'
        ) }
      >
        <Card>
          <CardBody>{ /* Section content */ }</CardBody>
        </Card>
		  </ProductSectionLayout>
    );
} }
</WooProductSectionItem>

<WooProductSectionItem.Slot location="tab/general" />

WooProductSectionItem (fill)

This is the fill component. You must provide the id prop to identify your section fill with a unique string. This component will accept a series of props:

Prop Type Description
id String A unique string to identify your fill. Used for configuiration management.
tabs Array Contains an array of name and order of which slots it should be rendered in.
pluginId String A unique plugin ID to identify the plugin/extension that this fill is associated with.
order Number (optional) This number will dictate the order that the sections rendered by a Slot will be appear.

WooProductSectionItem.Slot (slot)

This is the slot component. This will render all the registered fills that match the tab prop.

Name Type Description
tab String Unique to the location that the Slot appears, and must be the same as the one provided to any fills.