# Work parts

The pieces the kanban, task list and gantt share: a group head with its count, the grey well, a white card, a drop hole and a property row.

Section: Blocks / Work
Page: https://ui.heyramzi.com/components/work-parts
Import path: `@heyramzi/ui/components/work-parts`

## Import

```ts
import { GroupHead, PropertyRow, WorkCard, WorkWell, workLooks, } from "@heyramzi/ui/components/work-parts";
```

## Usage

```svelte
<GroupHead label="In progress" hue="var(--color-info)" count={1} onAdd={addTask} />
<WorkWell hue="var(--color-info)">
  <WorkCard>
    Send the signed SOW to the client
    {#snippet meta()}<span>Oct 28</span>{/snippet}
  </WorkCard>
</WorkWell>
<PropertyRow label="Assignee">Ada</PropertyRow>
```

## Demo

```svelte
<script lang="ts">
	import {
		GroupHead,
		PropertyRow,
		WorkCard,
		WorkWell,
		workLooks,
	} from "@heyramzi/ui/components/work-parts";
	import { CalendarBlank, User } from "phosphor-svelte";

	let held = $state(false);
</script>

<div class="grid w-full max-w-2xl gap-6 sm:grid-cols-2">
	<div class="flex flex-col gap-2">
		<GroupHead label="In progress" hue="var(--color-info)" count={1} onAdd={() => {}} />
		<WorkWell
			hue="var(--color-info)"
			active={held}
			onpointerenter={() => (held = true)}
			onpointerleave={() => (held = false)}
		>
			<WorkCard>
				Send the signed SOW to the client
				{#snippet meta()}<span>Oct 28</span><span>2 of 5</span>{/snippet}
			</WorkCard>
			<div class="h-16 {workLooks.hole}" aria-hidden="true"></div>
		</WorkWell>
	</div>

	<div class="flex flex-col gap-1">
		<PropertyRow label="Assignee" icon={User}>
			<span class="text-sm">Ramzi</span>
		</PropertyRow>
		<PropertyRow label="Due" icon={CalendarBlank}>
			<span class="text-sm tabular-nums">28 Oct</span>
		</PropertyRow>
	</div>
</div>
```

## API

### WorkWell

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `hue` | `string` |  | Any CSS colour. Tints the well only while something is held over it. |
| `active` | `boolean` | `false` | Something is held over the well. |
| `children` | `Snippet` |  | required |
| `class` | `string` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### GroupHead

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `label` | `string` |  |  |
| `title` | `Snippet` |  | Drawn in place of `label`, in the caller's own type, for a head whose name is markup. |
| `hue` | `string` |  | The status colour of the dot. Leave out for no dot. |
| `count` | `number` |  | Leave out for no count chip. |
| `onAdd` | `() => void` |  | Shows a plus at the end that adds an item to this group. |
| `addLabel` | `string` | `"Add"` |  |
| `children` | `Snippet` |  | Extra controls before the plus. |
| `class` | `string` |  |  |

### WorkCard

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `meta` | `Snippet` |  | The bottom row: dates, subtasks, time, avatars. |
| `children` | `Snippet` |  | required |
| `class` | `string` |  |  |

Every prop of `HTMLAttributes<HTMLElement>` from `svelte/elements`.

### PropertyRow

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `label` | `string` |  | required |
| `icon` | `Component<{ class?: string; "aria-hidden"?: boolean \| "true" \| "false" }>` |  | A Phosphor icon before the label. |
| `layout` | `"row" \| "responsive"` | `"row"` | `responsive`: the label hides in a narrow container (a chip row) and shows as a column from `@3xl` up. `row`: always icon, label, value. |
| `children` | `Snippet` |  | required |
| `class` | `string` |  |  |

### CountChip

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `count` | `number` |  | required |
| `size` | `"sm" \| "md"` | `"md"` | `sm` is 16px, for a count inside a control or on a button; `md` is 20px, beside a heading. |
| `tone` | `"neutral" \| "brand"` | `"neutral"` | `brand` marks a count that is on: an applied filter, the selected segment. |
| `class` | `string` |  |  |

Every prop of `HTMLAttributes<HTMLSpanElement>` from `svelte/elements`, except `children, class`.
