# Motion Bento

A section for service or feature overviews. A headline with a call-to-action sits above a 12-column grid of cards. Each card shows a soft gradient illustration that plays its own loop, with a title and a one-line description under it. Pick one of five built-in artworks per card, or draw your own in the `art` slot. The loops run on their own, pause when the section scrolls out of view, and cards lift on hover.

<demo-motion-bento>



</demo-motion-bento>

## Installation

```bash
npx shadcn-vue@latest add "https://nxui.geoql.in/r/motion-bento.json"
```

## Usage

```vue
<script setup lang="ts">
  import MotionBento from '~/components/ui/motion-bento/MotionBento.vue';
  import type { MotionBentoItem } from '~/components/ui/motion-bento/types';

  const items: MotionBentoItem[] = [
    {
      title: 'E-Commerce Systems',
      description: 'Storefronts that keep orders moving.',
      art: 'commerce',
      span: 7,
    },
    {
      title: 'Enterprise SLA',
      description: 'Uptime written into the contract.',
      art: 'sla',
      span: 5,
    },
    { title: 'Custom Development', art: 'integrations' },
    { title: 'UI/UX Design', art: 'design' },
    { title: 'Your own artwork' },
  ];
</script>

<template>
  <MotionBento
    heading="Not a generic agency. A studio with a contractual commitment to performance."
    highlight="contractual commitment"
    cta-label="Book a strategy call"
    :items="items"
  >
    <template #art="{ playing }">
      <div class="grid size-full place-items-center">
        <span :class="playing ? 'animate-pulse' : ''">Custom art</span>
      </div>
    </template>
  </MotionBento>
</template>
```

Cards without an `art` value render the `art` slot. Use `playing` from the slot to start and stop your own animation.

## Props

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        items
      </code>
    </td>
    
    <td>
      <code>
        MotionBentoItem[]
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Cards, placed in order into a 12-column grid.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        heading
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Section headline.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        highlight
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Part of <code>
        heading
      </code>
      
       drawn in a heavier weight.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cta-label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Label of the call-to-action button. Empty hides it.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cta-href
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Turns the call-to-action into a link.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        accent
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '#3b8cf0'
      </code>
    </td>
    
    <td>
      Accent colour for the artwork backgrounds and the button.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        paused
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Freezes every artwork loop.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        class
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        ''
      </code>
    </td>
    
    <td>
      Extra classes for the root element.
    </td>
  </tr>
</tbody>
</table>

## Item options

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        title
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Card title.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      One line under the title.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        art
      </code>
    </td>
    
    <td>
      <code>
        'commerce' | 'sla' | 'integrations' | 'design' | 'hosting'
      </code>
    </td>
    
    <td>
      Built-in artwork. Leave empty to use the <code>
        art
      </code>
      
       slot.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        span
      </code>
    </td>
    
    <td>
      <code>
        3 | 4 | 5 | 6 | 7 | 8 | 12
      </code>
    </td>
    
    <td>
      Columns the card spans from the <code>
        md
      </code>
      
       breakpoint. Default <code>
        4
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

The built-in artworks:

- `commerce` — three product cards rotate through a centre spot while the order count ticks up.
- `sla` — an envelope opens, a check badge rises out of it and three service chips pop in.
- `integrations` — four integration tiles orbit a central app tile in quarter turns.
- `design` — an editor panel with moving sliders, a scrolling strip of design tools and two collaborator cursors.
- `hosting` — a glass lightning bolt with a breathing frame and light pulses running along circuit lines.

## Slots and events

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Props
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        #header
      </code>
      
       slot
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Replaces the headline.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        #cta
      </code>
      
       slot
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Replaces the call-to-action button.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        #art
      </code>
      
       slot
    </td>
    
    <td>
      <code>
        { item, index, playing, still }
      </code>
    </td>
    
    <td>
      Artwork for cards without an <code>
        art
      </code>
      
       value.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cta
      </code>
      
       event
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Fires when the button is clicked and has no <code>
        cta-href
      </code>
      
      .
    </td>
  </tr>
</tbody>
</table>

## Accessibility

- The section is labelled by its headline, and each card title is an `h3`.
- The artwork is decorative and hidden from screen readers.
- The button and link show a focus ring.
- With reduced motion turned on, every artwork shows one finished, still frame and cards do not lift on hover.
