> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Elements

> Drop-in HTML tags for buttons, inputs, and typewriter animations, plus paste-and-edit recipes for review and product cards.

export const ProductCardPreview = () => {
  const openChat = () => {
    if (typeof window !== 'undefined' && window.Molin && window.Molin.openChat) {
      window.Molin.openChat({
        autoSend: true
      });
    } else {
      alert('Molin widget not loaded. This is just a demo.');
    }
  };
  return <div style={{
    position: 'relative',
    overflow: 'hidden',
    borderRadius: '16px',
    padding: '40px 32px',
    background: 'linear-gradient(145deg, #0f1225, #1a1d3a)',
    border: '1px solid rgba(255, 255, 255, 0.06)',
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    gap: '20px',
    textAlign: 'center'
  }}>
      <div aria-hidden="true" style={{
    position: 'absolute',
    width: '200px',
    height: '200px',
    top: '20%',
    left: '50%',
    transform: 'translate(-50%, -50%)',
    background: 'radial-gradient(circle, rgba(96, 31, 235, 0.25), transparent 70%)',
    pointerEvents: 'none'
  }} />
      <div style={{
    position: 'relative',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    width: '64px',
    height: '64px',
    borderRadius: '9999px',
    background: 'rgba(96, 31, 235, 0.6)',
    color: 'white',
    boxShadow: '0 0 40px rgba(96, 31, 235, 0.4), 0 0 80px rgba(96, 31, 235, 0.15)'
  }}>
        <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
          <path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z" />
        </svg>
      </div>
      <p style={{
    position: 'relative',
    maxWidth: '260px',
    margin: 0,
    fontSize: '14px',
    lineHeight: 1.5,
    color: '#9ca3af'
  }}>Get personalized recommendations in seconds</p>
      <button type="button" onClick={openChat} style={{
    position: 'relative',
    border: 'none',
    borderRadius: '9999px',
    background: '#601feb',
    color: '#fff',
    padding: '10px 20px',
    fontSize: '14px',
    fontWeight: 500,
    cursor: 'pointer'
  }}>
        Ask our AI
      </button>
    </div>;
};

export const ReviewCardPreview = () => {
  const openChat = () => {
    if (typeof window !== 'undefined' && window.Molin && window.Molin.openChat) {
      window.Molin.openChat({
        message: 'What do people think about this product?',
        autoSend: true
      });
    } else {
      alert('Molin widget not loaded. This is just a demo.');
    }
  };
  return <div style={{
    border: '1px solid rgba(96, 31, 235, 0.15)',
    borderRadius: '16px',
    padding: '24px',
    background: 'linear-gradient(145deg, rgba(96, 31, 235, 0.03), rgba(96, 31, 235, 0.1))'
  }}>
      <div style={{
    display: 'flex',
    gap: '2px',
    marginBottom: '12px'
  }}>
        {[0, 1, 2, 3, 4].map(i => <svg key={i} width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true">
            <path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" />
          </svg>)}
      </div>
      <h3 style={{
    margin: 0,
    fontWeight: 600,
    fontSize: '15px',
    color: '#111'
  }}>What do customers say?</h3>
      <p style={{
    margin: '4px 0 16px',
    fontSize: '14px',
    color: 'rgba(96, 31, 235, 0.7)'
  }}>Ask our AI for a summary of customer reviews</p>
      <button type="button" onClick={openChat} style={{
    border: 'none',
    borderRadius: '9999px',
    background: '#601feb',
    color: '#fff',
    padding: '10px 20px',
    fontSize: '14px',
    fontWeight: 500,
    cursor: 'pointer'
  }}>
        Ask about reviews
      </button>
    </div>;
};

Elements are prebuilt components you embed on your store with a single HTML tag. No JavaScript, no setup. They theme from their style attributes, with sensible defaults. Override any attribute when you want a different look.

<Note>
  The [Elements admin page](https://molin.ai/app/elements) lets you tweak attributes in a live preview and copy the resulting HTML to paste into your store theme. Use it if you want to iterate on the
  look without editing your site between attempts.
</Note>

## Shared style attributes

Every component accepts these style attributes. Set them on the tag, or copy a pre-styled snippet from the [Elements admin page](https://molin.ai/app/elements), which fills in your brand color for you.

<ParamField body="bg" type="CSS color" optional>
  Background color. Defaults to the Molin brand purple (`#601feb`). Snippets copied from the Elements admin page set this to your widget's brand color.
</ParamField>

<ParamField body="color" type="CSS color" optional>
  Text and icon color. Defaults to white or black, whichever contrasts better with `bg`.
</ParamField>

<ParamField body="radius" type="'none' | 'sm' | 'md' | 'lg' | 'full'" optional default="full">
  Corner rounding preset.
</ParamField>

<ParamField body="size" type="'sm' | 'md' | 'lg'" optional default="md">
  Padding and font size preset.
</ParamField>

<ParamField body="font-weight" type="'normal' | 'medium' | 'semibold' | 'bold'" optional default="medium">
  Font weight for labels and headings so the component matches your store typography.
</ParamField>

## Open the chat in fullscreen

Every element that opens the chat (`<molin-shop-ai-button>`, `<molin-shop-ai-ask>`, and `<molin-shop-ai-typewriter>`) accepts a `fullscreen` attribute. When present, clicking the element opens the chat window filling the whole screen on desktop. On mobile the chat is always fullscreen.

```html theme={null}
<molin-shop-ai-button fullscreen autosend message="I need help with my order">Get help</molin-shop-ai-button>
```

<ParamField body="fullscreen" type="boolean" optional>
  When present, the chat opens filling the screen on desktop instead of the floating window. Mobile is always fullscreen.
</ParamField>

## `<molin-shop-ai-button>`

A call-to-action button. Opens the chat, optionally prefilling or auto-sending a message.
The same tag doubles as a quick-question chip via the `variant`, `size`, and `icon` attributes, see the chip recipe below.

```html theme={null}
<molin-shop-ai-button message="Tell me about this product" autosend> Ask about this product </molin-shop-ai-button>
```

Chip configuration for FAQ rows:

```html theme={null}
<molin-shop-ai-button variant="outline" size="sm" icon="none" autosend message="What's your return policy?"> Returns </molin-shop-ai-button>
```

<ParamField body="message" type="string" optional>
  Text to prefill or autosend when the chat opens.
</ParamField>

<ParamField body="autosend" type="boolean" optional>
  When present, sends `message` immediately instead of just prefilling the input.
</ParamField>

<ParamField body="icon" type="'chat' | 'sparkle' | 'none'" optional default="chat">
  Leading icon inside the button.
</ParamField>

<ParamField body="variant" type="'solid' | 'outline' | 'ghost'" optional default="solid">
  Visual style.
</ParamField>

<ParamField body="size" type="'sm' | 'md' | 'lg'" optional default="md">
  Padding and font size preset. Use `sm` for chip-style pills.
</ParamField>

The button's label is the inner text of the tag (the default slot).

## `<molin-shop-ai-ask>`

An input field with a send button. On submit, opens the chat with whatever the visitor typed.
The same tag doubles as a product search bar via the `prefix` and `icon` attributes, see the second example below.

```html theme={null}
<molin-shop-ai-ask placeholder="Ask anything about our products"></molin-shop-ai-ask>
```

Product-search configuration:

```html theme={null}
<molin-shop-ai-ask icon="search" prefix="Help me find: " placeholder="Search products…" submit-label="Search"></molin-shop-ai-ask>
```

<ParamField body="placeholder" type="string" optional>
  Input placeholder text.
</ParamField>

<ParamField body="submit-label" type="string" optional default="Ask">
  Label on the submit button.
</ParamField>

<ParamField body="prefix" type="string" optional default="">
  Text prepended to the visitor's typed text before it is sent to the chat. Use it to turn an "Ask AI" input into a "Help me find" search prompt.
</ParamField>

<ParamField body="icon" type="'none' | 'search' | 'sparkle' | 'chat'" optional default="none">
  Leading icon inside the input.
</ParamField>

<ParamField body="autosend" type="boolean" optional default="true">
  When `true`, the typed text is sent immediately on submit. Set to `false` to only prefill it.
</ParamField>

<ParamField body="input-bg" type="CSS color" optional>
  Background color of the input field.
</ParamField>

<ParamField body="border" type="'solid' | 'none'" optional default="solid">
  Whether the input has a visible border.
</ParamField>

## `<molin-shop-ai-typewriter>`

An animated CTA that cycles through up to 3 messages with a typewriter effect. The motion draws attention and the rotating prompts teach visitors what the AI can answer. On click, opens the chat with the current message.

```html theme={null}
<molin-shop-ai-typewriter text-1="Ask AI about this product" text-2="What sizes are available?"></molin-shop-ai-typewriter>
```

<ParamField body="text-1" type="string" optional default="Ask AI about this product">
  First message (always displayed).
</ParamField>

<ParamField body="text-2" type="string" optional>
  Second message to cycle through. Leave empty to only show message 1.
</ParamField>

<ParamField body="text-3" type="string" optional>
  Third message to cycle through.
</ParamField>

<ParamField body="autosend" type="boolean" optional default="true">
  When `true`, the current message is sent immediately on click.
</ParamField>

<ParamField body="icon" type="'help' | 'chat' | 'sparkle' | 'none'" optional default="help">
  Leading icon to the left of the animated text.
</ParamField>

<ParamField body="type-speed" type="number" optional default="50">
  Milliseconds per character when typing.
</ParamField>

<ParamField body="delete-speed" type="number" optional default="30">
  Milliseconds per character when deleting.
</ParamField>

<ParamField body="pause" type="number" optional default="2000">
  Milliseconds to hold the fully-typed message before deleting.
</ParamField>

## Review card recipe

A card with decorative stars that fits into a product review section. Visitors who want a summary of customer reviews tap the button and the chat opens with a ready-to-send question. Paste the snippet below into your product page and edit colors, copy, and spacing to match your store.

<ReviewCardPreview />

```html theme={null}
<div style="border: 1px solid rgba(96, 31, 235, 0.15); border-radius: 16px; padding: 24px; background: linear-gradient(145deg, rgba(96, 31, 235, 0.03), rgba(96, 31, 235, 0.1));">
  <div style="display: flex; gap: 2px; margin-bottom: 12px;">
    <svg width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" /></svg>
    <svg width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" /></svg>
    <svg width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" /></svg>
    <svg width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" /></svg>
    <svg width="18" height="18" viewBox="0 0 24 24" fill="#f59e0b" aria-hidden="true"><path d="M12 2l2.9 6.3 6.9.7-5.1 4.6 1.4 6.8L12 17.8 5.9 20.4l1.4-6.8L2.2 9l6.9-.7L12 2z" /></svg>
  </div>
  <h3 style="margin: 0; font-weight: 600; font-size: 15px; color: #111;">What do customers say?</h3>
  <p style="margin: 4px 0 16px; font-size: 14px; color: rgba(96, 31, 235, 0.7);">Ask our AI for a summary of customer reviews</p>
  <molin-shop-ai-button message="What do people think about this product?" autosend bg="#601feb" icon="none">Ask about reviews</molin-shop-ai-button>
</div>
```

## Promotional product card recipe

A dark promotional card that slots into your product grid. Visitors tap the button and the AI helps them find what they need. Paste the snippet below into your grid and adjust copy, colors, or the icon to match your store.

<ProductCardPreview />

```html theme={null}
<div
  style="position: relative; overflow: hidden; border-radius: 16px; padding: 40px 32px; background: linear-gradient(145deg, #0f1225, #1a1d3a); border: 1px solid rgba(255, 255, 255, 0.06); display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center;">
  <div
    aria-hidden="true"
    style="position: absolute; width: 200px; height: 200px; top: 20%; left: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(96, 31, 235, 0.25), transparent 70%); pointer-events: none;"></div>
  <div
    style="position: relative; display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 9999px; background: rgba(96, 31, 235, 0.6); color: white; box-shadow: 0 0 40px rgba(96, 31, 235, 0.4), 0 0 80px rgba(96, 31, 235, 0.15);">
    <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z" /></svg>
  </div>
  <p style="position: relative; max-width: 260px; margin: 0; font-size: 14px; line-height: 1.5; color: #9ca3af;">Get personalized recommendations in seconds</p>
  <molin-shop-ai-button bg="#601feb">Ask our AI</molin-shop-ai-button>
</div>
```
