# List row

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

The workhorse row: star, avatar, title, subtitle and preview, a status badge, meta and an overflow button.

`import { EcoListRow, EcoListRows } from "vue-ecosphere"`

## Rows

Unread by default; opening a row settles it to read. The row is a button: click it or press Enter. Star and overflow act on their own.

Vue (vue-ecosphere):

```vue
<EcoListRows>
  <EcoListRow
    v-for="r in rows"
    :key="r.id"
    v-model:starred="r.starred"
    :initials="r.initials"
    :title="r.title"
    :subtitle="r.subtitle"
    :preview="r.preview"
    :status="r.status"
    :status-label="r.statusLabel"
    :status-dot="r.dot"
    :meta="r.meta"
    :read="r.read"
    @open="open(r)"
    @more="showMenu(r, $event)"
  />
</EcoListRows>
```

React (react-ecosphere):

```tsx
<EcoListRows>
  {rows.map((r) => (
    <EcoListRow
      key={r.id}
      starred={r.starred}
      onStarredChange={(starred) => update(r.id, { starred })}
      initials={r.initials}
      title={r.title}
      subtitle={r.subtitle}
      preview={r.preview}
      status={r.status}
      statusLabel={r.statusLabel}
      statusDot={r.dot}
      meta={r.meta}
      read={r.read}
      onOpen={() => open(r)}
      onMore={(event) => showMenu(r, event)}
    />
  ))}
</EcoListRows>
```

## Badge slot

Pass any badge markup through the #badge slot.

Vue (vue-ecosphere):

```vue
<EcoListRow title="Access log" subtitle="Unrecognised sign-in from a new device" initials="AL" read meta="9 Aug">
  <template #badge><span class="badge badge--danger"><span class="badge__dot" aria-hidden="true"></span>Needs review</span></template>
</EcoListRow>
```

React (react-ecosphere):

```tsx
<EcoListRow
  title="Access log"
  subtitle="Unrecognised sign-in from a new device"
  initials="AL"
  read
  meta="9 Aug"
  badge={<span className="badge badge--danger"><span className="badge__dot" aria-hidden="true"></span>Needs review</span>}
/>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title / subtitle / preview` | `string` | — | The body in fixed order. Only the preview truncates. Slots of the same names override. |
| `initials` | `string` | — | Avatar initials. The #avatar slot overrides it. |
| `read` | `boolean` | false | Settled row (is-read). Unread rows show the dot and an sr “Unread”. |
| `v-model:starred` | `boolean` | false | The leading star toggle (aria-pressed). |
| `starrable` | `boolean` | true | Show the star toggle. |
| `status / statusLabel` | `StatusTone / string` | — | Status badge; or use the #badge slot. |
| `statusDot` | `boolean` | true | Show the badge dot. |
| `meta` | `string` | — | Time or date at the end. |
| `selected` | `boolean` | false | Selected row (is-sel). |
| `moreButton / moreExpanded` | `boolean` | true / false | Overflow button and its aria-expanded while its menu is open. |
| `@open` | `(event) => void` | — | Row clicked, or Enter / Space while the row has focus. |
| `@more` | `(event: MouseEvent) => void` | — | Overflow button clicked. Open a Menu from it. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title / subtitle / preview` | `ReactNode` | — | The body in fixed order. Only the preview truncates. A node renders as given; the star and overflow buttons are named from title only when it is a string. |
| `initials` | `string` | — | Avatar initials. The avatar prop (ReactNode) overrides it. |
| `read` | `boolean` | false | Settled row (is-read). Unread rows show the dot and an sr “Unread”. |
| `starred / onStarredChange` | `boolean` | false | The leading star toggle (aria-pressed). |
| `starrable` | `boolean` | true | Show the star toggle. |
| `status / statusLabel` | `StatusTone / string` | — | Status badge; or pass your own as the badge prop (ReactNode). |
| `statusDot` | `boolean` | true | Show the badge dot. |
| `meta` | `ReactNode` | — | Time or date at the end. |
| `selected` | `boolean` | false | Selected row (is-sel). |
| `moreButton / moreExpanded` | `boolean` | true / false | Overflow button and its aria-expanded while its menu is open. |
| `onOpen` | `(event) => void` | — | Row clicked, or Enter / Space while the row has focus. |
| `onMore` | `(event: MouseEvent) => void` | — | Overflow button clicked. Open a Menu from it. |
