Result
アイコン、メッセージ、次の操作を持つ結果画面です。
Try again
We couldn't load this screen. Please check your connection and try again.
インポート
「インポート」セクションimport { Result, ResultButton } from "@pelagornis/page/components";上のプレビューはこのファイルを描画したものです。src/components/ にコピーして使い始めてください。
import { Result, ResultButton } from "@pelagornis/page/components";
export default function ResultDemo() { return ( <Result variant="error" title="Try again" description="We couldn't load this screen. Please check your connection and try again." actions={<ResultButton>Try again</ResultButton>} /> );}MDX で使う
「MDX で使う」セクションResult は React の状態を共有する複数のパーツで構成されます。MDX に書いた子要素はそれぞれ別のアイランドとして描画されるため、パーツ同士がつながりません。上の例のように .tsx ファイルで組み立て、そのファイルをインポートしてください。
---title: Example---
import ResultExample from "../../components/ResultExample";
<ResultExample client:load />client:load はページの読み込み時にアイランドをハイドレートします。ページの下の方にあるコンテンツには client:visible を使ってください。
Markdoc で使う
「Markdoc で使う」セクションMarkdoc タグは Astro コンポーネントを描画し、このコンポーネントはクライアント状態が必要です。例をハイドレートする .astro ファイルで包み、そのファイルをタグとして登録してください。
---import ResultExample from "../ResultExample";---
<ResultExample client:load />import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";import starlightMarkdoc from "@astrojs/starlight-markdoc";import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({ extends: [starlightMarkdoc(), pageMarkdoc()], tags: { "result-example": { render: component("./src/components/markdoc/ResultExample.astro"), selfClosing: true, }, },});{% result-example /%}バリアント
「バリアント」セクション各 variant prop に渡せる値です。
| Prop | 値 |
|---|---|
variant | success info warning error |
コンポーネントの各パーツと、それぞれが描画する data-refineui の役割です。
| パーツ | ロール |
|---|---|
root | result |
icon | result-icon |
title | result-title |
description | result-description |
actions | result-actions |
コンポーネントがスタイルする状態です。コンポーネント状態は data 属性として公開されます。
キーボード
「キーボード」セクションフォーカスがあるときにコンポーネントが扱うキーです。
- デザインガイドとトークンの詳細は RefineUI · Result を参照してください。
- 共通のルールは MDX で使う と Markdoc で使う を参照してください。