Skip to content
kerfjsGitHub

ConversationList

A list of channels and people, with previews and unread counts.

SourcePackage @kerf-js/veneer

Preview

tsx
import { state } from '@kerf-js/core'import {  ConversationList,  Stack,  Text} from '@kerf-js/veneer'import type { ChatConversation } from '@kerf-js/veneer'export function Inbox() {  const open = state('incidents')  const name = () =>    CONVERSATIONS.find((c) => c.id === open.value)!.name  return (    <Stack gap="related">      <ConversationList        title={<Text role="label">Messages</Text>}        items={CONVERSATIONS}        value={open}      />      <Text subtle>Open: {name()}</Text>    </Stack>  )}const CONVERSATIONS: ChatConversation[] = [  {    id: 'incidents',    name: '# incidents',    color: 3,    channel: true,    preview: 'Sam: Rolled back, 5xx are dropping',    time: '15:41',    unread: 3,    pinned: true,  },  {    id: 'deploys',    name: '# deploys',    color: 5,    channel: true,    preview: 'storefront is live',    time: '16:42',    unread: 1,  },  {    id: 'jun',    name: 'Jun Tanaka',    color: 2,    preview: 'You: thanks, merging now',    time: '14:30',    online: true,  },  {    id: 'web',    name: '# web',    color: 4,    channel: true,    preview: 'Priya: new image cache is in',    time: '12:05',  },  {    id: 'lena',    name: 'Lena Fischer',    color: 5,    preview: 'Ranking v2 is building',    time: 'Thu',  },  {    id: 'random',    name: '# random',    color: 8,    channel: true,    preview: 'Tomás pinned a message',    time: 'Wed',    muted: true,  },]

Installation

npm install @kerf-js/veneer

Usage

tsx
import { ConversationList } from '@kerf-js/veneer'

Accessibility

↑↓
Moves through the list
HomeEnd
Jumps to the first or last
Enter
Opens it

API Reference

PropTypeDefaultDescription
labelstring'Conversations'Names the list.
titleunknown—The heading.
actionsunknown—Buttons beside the heading.
itemsChatConversation[]—The conversations.
valuestring | State<string>—The open one, as a state or an id.
EventTypeDefaultDescription
onSelect((c: ChatConversation) => void)—Called when one is picked.

Parts

Every element carries a stable name, so you can style it from your own CSS: [data-scope="conversations"] [data-part="side"]

side

RelatedThread