# Row group

Source: https://ecosphere.dev/docs/data/row-group (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A titled band with its rows underneath: the unit you repeat when a list is ranked or bucketed rather than flat.

`import { EcoRowGroup, EcoRowItem } from "vue-ecosphere"`

## Group and rows

The band dot takes the same ramp as the score pill, so the group’s colour and its rows’ scores agree. Two or three groups per view.

Vue (vue-ecosphere):

```vue
<EcoRowGroup
  title="Closest matches"
  :tone="1"
  :items="items"
  @open="(item) => go(item)"
  @save="(item) => (item.saved = !item.saved)"
  @action="(item) => go(item)"
/>
```

React (react-ecosphere):

```tsx
const [items, setItems] = useState(initialItems);

<EcoRowGroup
  title="Closest matches"
  tone={1}
  items={items}
  onOpen={(item) => go(item)}
  onSave={(item) => setItems((list) => list.map((i) => (i.id === item.id ? { ...i, saved: !i.saved } : i)))}
  onAction={(item) => go(item)}
/>
```

## Rows in the slot

Compose rows yourself with EcoRowItem.

Vue (vue-ecosphere):

```vue
<EcoRowGroup title="Closest matches">
  <EcoRowItem name="payments-gateway" initials="PG" score="95%" hint="Service · owned by Platform"
    :status="{ label: 'Healthy', tone: 'success' }" @open="go" />
</EcoRowGroup>
```

React (react-ecosphere):

```tsx
<EcoRowGroup title="Closest matches">
  <EcoRowItem name="payments-gateway" initials="PG" score="95%" hint="Service · owned by Platform"
    status={{ label: "Healthy", tone: "success" }} onOpen={go} />
</EcoRowGroup>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | — | Band title. |
| `tone` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | 1 | Band dot (dot1…dot6); also the default score step of its rows. |
| `level` | `2 \| 3 \| 4` | 2 | Heading level of the band title. |
| `items` | `EcoRowItemData[]` | — | Rows as data: id, initials, name, hint, score, scoreTone, status, saved. Or put EcoRowItems in the default slot. |
| `@open / @save / @action` | `(item) => void` | — | Row opened (click, Enter), bookmark toggled, primary clicked. |
| `#actions` | `{ item }` | — | Replace a row’s badge and buttons. |
| `EcoRowItem` | `component` | — | name, hint, initials, score, scoreTone, status, saveButton, saved, actionLabel (default “Open”), selected. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | — | Band title. |
| `tone` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | 1 | Band dot (dot1…dot6); also the default score step of its rows. |
| `level` | `2 \| 3 \| 4` | 2 | Heading level of the band title. |
| `items` | `EcoRowItemData[]` | — | Rows as data: id, initials, name, hint, score, scoreTone, status, saved. Or put EcoRowItems in children. |
| `onOpen / onSave / onAction` | `(item) => void` | — | Row opened (click, Enter), bookmark toggled, primary clicked. |
| `renderActions` | `(scope: { item }) => ReactNode` | — | Replace a row’s badge and buttons. |
| `EcoRowItem` | `component` | — | name, hint, initials, score, scoreTone, status, saveButton, saved, actionLabel (default “Open”), selected; avatar and actions (ReactNode); onOpen, onSave, onAction. |
