Resizable
ドラッグできるハンドルで区切られた分割パネルです。
Sidebar
Content
インポート
「インポート」セクションimport { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@pelagornis/page/components";上のプレビューはこのファイルを描画したものです。src/components/ にコピーして使い始めてください。
import { Box, ResizableHandle, ResizablePanel, ResizablePanelGroup, Text,} from "@pelagornis/page/components";
export default function ResizableDemo() { return ( <Box border="strokeWidthThin" borderColor="borderDefault" radius="roundedLarge" className="h-48 w-full overflow-hidden"> <ResizablePanelGroup orientation="horizontal"> <ResizablePanel defaultSize={35} minSize={20}> <Box padding="sizeLarge"> <Text variant="subtitleMd">Sidebar</Text> </Box> </ResizablePanel> <ResizableHandle /> <ResizablePanel defaultSize={65} minSize={30}> <Box padding="sizeLarge"> <Text variant="subtitleMd">Content</Text> </Box> </ResizablePanel> </ResizablePanelGroup> </Box> );}MDX で使う
「MDX で使う」セクションResizable は React の状態を共有する複数のパーツで構成されます。MDX に書いた子要素はそれぞれ別のアイランドとして描画されるため、パーツ同士がつながりません。上の例のように .tsx ファイルで組み立て、そのファイルをインポートしてください。
---title: Example---
import ResizableExample from "../../components/ResizableExample";
<ResizableExample client:load />client:load はページの読み込み時にアイランドをハイドレートします。ページの下の方にあるコンテンツには client:visible を使ってください。
Markdoc で使う
「Markdoc で使う」セクションMarkdoc のタグは Astro コンポーネントを描画しますが、このコンポーネントにはクライアントの状態が必要です。例をハイドレートする .astro ファイルで包み、そのファイルをタグとして登録してください。
---import ResizableExample from "../ResizableExample";---
<ResizableExample 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: { "resizable-example": { render: component("./src/components/markdoc/ResizableExample.astro"), selfClosing: true, }, },});{% resizable-example /%}バリアント
「バリアント」セクション各 variant prop が受け付ける値です。
| Prop | 値 |
|---|---|
orientation | horizontal vertical |
コンポーネントを構成するパーツと、それぞれが描画する data-refineui のロールです。
| パーツ | ロール |
|---|---|
root | resizable-panel-group |
resizable_handle | resizable-handle |
resizable_panel | resizable-panel |
キーボード
「キーボード」セクションフォーカスがあるときにコンポーネントが処理するキーです。
| キー | 動作 |
|---|---|
| Home | first-trigger |
| End | last-trigger |
- デザインのガイドとトークンの詳細は RefineUI · Resizable を参照してください。
- 共通のルールは MDX で使う と Markdoc で使う を参照してください。