> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Creating a New Component

## Article: Creating a New Component

## Article Link: https://dev.wix.com/docs/wix-design-system/contributing/creating-a-new-component.md

## Article Content:

<!-- heading -->

# Creating a New Component

<!-- end heading -->

## How to Create a New Component

1. To create a new component, run the generator from the root folder of the monorepo:

<!-- grid layout -->

<!-- grid layout item -->

<!-- grid layout content -->

```sh
pnpm --filter @wix/design-system generate-component
```

<!-- end grid layout -->

<!-- end grid layout item -->

<!-- end grid layout content -->

or

<!-- grid layout -->

<!-- grid layout item -->

<!-- grid layout content -->

```sh
npm run generate-component --workspace=@wix/design-system
```

<!-- end grid layout -->

<!-- end grid layout item -->

<!-- end grid layout content -->

You'll be prompted for a component name (make sure to use `PascalCase`) and an optional description.
The generator will automatically:

- Create files according to structure defined in the **Component Structure** page.
- Add the necessary export statements in these two files:

<!-- grid layout -->

<!-- grid layout item -->

<!-- grid layout content -->

```bash
src/index.ts
```

<!-- end grid layout item -->

<!-- end grid layout content -->

<!-- grid layout item -->

<!-- grid layout content -->

```bash
stories/index.js
```

<!-- end grid layout item -->

<!-- end grid layout content -->

<!-- end grid layout -->

Additionally, the generator will create a sample `.story.js` file. You can find more about using story.js [here](https://github.com/wix/wix-ui/blob/master/packages/wix-storybook-utils/docs/usage.md).

2. Make sure to rearrange the `stories/index.js` as needed. _The order of require statements in that file will reflect in the rendered Storybook sidebar._

---

## API (Props)

### Mandatory Props

| Prop      | Rule     | Description                                                                                                                                                                    |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| dataHook  | Required | Every component should accept a `dataHook` property, which is applied as a data-hook attribute on the component's root element. This attribute is used as a selector in tests. |
| className | Required | The convention for styling the component's root element is to expose a `className` property. _NOTE: This prop is only used internally by WDS._                                 |

### Props Guidelines

| Prop            | Rule       | Description                                                                                                                                                                                 |
| --------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| initialPropName | Convention | Props that set an initial value to an identical uncontrolled state should be named with an `initial` prefix.                                                                                |
| xxxProps        | Convention | If the component is wrapping another component (or native DOM element) and its props are needed, pass them using the convention `xxxProps`. For example: `inputProps`, `tooltipProps`, etc. |

## Styling

We use Stylable. Check the documentation to [learn how to use it](https://stylable.io) effectively.

---

## Typography

- For common typography, components should use the `Text` or `Heading` components.
- If you absolutely can't use those components, you can use the `Typography.st.css` file directly.

---

## Documentation

- Document each property with a `/** */` comment above their TypeScript definitions in the `*.types.ts` file. [_AutoDocs_](https://storybook.js.org/docs/writing-docs/autodocs) will utilize this information.

<br>
<br>
<br>
<br>
<br>