本文へ移動
日本語
「通知の受信箱」は Pro に含まれます。解除するとプレビューが表示されます。

使い方

import { DashboardInbox } from './DashboardInbox.jsx'

// Without items the inbox shows its sample morning. Wire it to yours; an item of your own kind
// brings its tag, badge icon and action words:
<DashboardInbox
  locale="en"
  items={inbox.items}      // [{ id, kind, from, title, body, at, unread?, detail?, tag?, icon?, actionLabel?, actionDone? }]
  onOpen={(item) => inbox.open(item.id)}
  onMarkRead={(item, read) => inbox.mark(item.id, read)}
  onMarkAllRead={() => inbox.markAllRead()}
  onArchive={(item) => inbox.archive(item.id)}   // called once the undo has run out
  onAction={(item, reply) => inbox.act(item, reply)}   // the reading pane's main button (reply: the text typed for a mention); may return a promise
  loading={inbox.loading}
  error={inbox.error}
  onRetry={inbox.reload}
/>

プロパティ

プロパティ型既定値説明
locale'en' | 'zh-CN' | 'es' | 'ja''en'組み込みの文言、サンプルのメッセージ、時刻の書式の言語。
itemsArray<{ id, kind, from, title, body, at, unread?, detail?, tag?, icon?, actionLabel?, actionDone? }>sample morning新しい順。kind が 'mention' なら返信欄付き。'order'・'stock'・'team' は組み込みのタグ・バッジ・操作があり、それ以外の kind は項目自身の tag(ラベル)、icon(バッジ:アイコン名かノード)、actionLabel と actionDone(メインボタンの実行前後の文言)を使います。at は日付または日付文字列、detail は [項目, 値] の配列で小さな明細として表示します。
nowDate | stringnow「今日」「昨日」の見出しの基準になる日時。
onOpen / onMarkRead(item) => void / (item, read) => void—メッセージを開いたとき(既読になります)、または行のボタンで既読・未読にしたとき。
onMarkAllRead() => void—すべて既読にしたとき。
onArchive(item) => void—アーカイブして元に戻す期限が切れたか閉じられたとき。元に戻した場合は呼ばれません。
onAction(item, reply) => Promise | void—プレビューのメインボタン(返信、注文を開く など)。メンションではプレビューに書いた返信も渡します。Promise の間は待機表示になります。
loadingbooleanfalse受信箱のスケルトンを表示します。
error / onRetryboolean | string / () => voidfalse再試行ボタン付きのエラーを表示。文字列を渡すと説明を置き換えます。
labelsobject—組み込みの文言を置き換えます(キーは copy.js と同じ)。
classNamestring—ルート要素に追加するクラス。

プロジェクトに追加

Pro にはこのブロックのソース一式が含まれます。指示をコピーしてエージェントに導入を依頼できます。

DashboardInbox.jsxdashboard-inbox.csscopy.jskit.jsxkit.cssui/base-button/ui/empty-state/ui/alert-banner/ui/undo-snackbar/ui/skeleton-shimmer/ui/sliding-tabs/tokens.cssREADME.md

ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。