ドラッグ&ドロップ
- react-draggable:
react-draggable
は、個々のコンポーネントをドラッグ可能にするシンプルなAPIを提供します。 - react-grid-layout:
react-grid-layout
は、グリッド内でコンポーネントをドラッグ&ドロップできる高度な機能を提供します。 - react-split-pane:
react-split-pane
は、パネルを分割し、ユーザーがドラッグしてサイズを調整できますが、コンポーネントの再配置はできません。 - flexlayout-react:
flexlayout-react
は、フレックスボックスを利用した複雑なレイアウトをサポートし、タブやパネルのドラッグ&ドロップが可能です。 - react-mosaic-component:
react-mosaic-component
は、モザイクスタイルのレイアウトで、コンポーネントをドラッグして再配置できます。 - react-flexbox-grid:
react-flexbox-grid
は、フレックスボックスを利用したグリッドレイアウトを提供しますが、ドラッグ&ドロップ機能はありません。
リサイズ
- react-draggable:
react-draggable
は、ドラッグ中にリサイズを行うことはできません。 - react-grid-layout:
react-grid-layout
は、グリッド内のコンポーネントをリサイズ可能で、サイズ変更に応じたレイアウト調整が行えます。 - react-split-pane:
react-split-pane
は、ユーザーがパネルの境界をドラッグしてリサイズできるシンプルな機能を提供します。 - flexlayout-react:
flexlayout-react
は、パネルのリサイズをサポートし、レイアウトの柔軟性を提供します。 - react-mosaic-component:
react-mosaic-component
は、コンポーネントのリサイズをサポートし、モザイクレイアウトの柔軟性を高めます。 - react-flexbox-grid:
react-flexbox-grid
は、リサイズ機能を提供しません。
レイアウトの永続化
- react-draggable:
react-draggable
は、レイアウトの状態を永続化する機能はありません。 - react-grid-layout:
react-grid-layout
は、レイアウトの状態を保存し、再配置後も元の状態を保持することができます。 - react-split-pane:
react-split-pane
は、パネルのサイズを永続化する機能はありません。 - flexlayout-react:
flexlayout-react
は、レイアウトの状態を保存し、再ロード時に復元する機能を提供します。 - react-mosaic-component:
react-mosaic-component
は、レイアウトの状態を管理し、再配置後も元のレイアウトを保持することができます。 - react-flexbox-grid:
react-flexbox-grid
は、レイアウトの永続化機能を提供しません。
レスポンシブデザイン
- react-draggable:
react-draggable
は、レスポンシブデザインをサポートしますが、コンポーネントのサイズや位置は手動で調整する必要があります。 - react-grid-layout:
react-grid-layout
は、レスポンシブグリッドレイアウトをサポートし、ウィンドウサイズに応じてコンポーネントの配置を調整できます。 - react-split-pane:
react-split-pane
は、レスポンシブデザインをサポートしますが、パネルのサイズは固定されるため、デザインの調整が必要です。 - flexlayout-react:
flexlayout-react
は、レスポンシブデザインをサポートし、ウィンドウサイズに応じてレイアウトが調整されます。 - react-mosaic-component:
react-mosaic-component
は、レスポンシブデザインをサポートしますが、モザイクレイアウトの特性上、調整が必要な場合があります。 - react-flexbox-grid:
react-flexbox-grid
は、フレックスボックスを利用したレスポンシブグリッドを提供します。
コード例
- react-draggable:
react-draggable
のコード例import React from 'react'; import Draggable from 'react-draggable'; const DraggableComponent = () => { return ( <Draggable> <div style={{ width: '100px', height: '100px', background: 'lightblue' }}> ドラッグ可能なコンポーネント </div> </Draggable> ); }; export default DraggableComponent;
- react-grid-layout:
react-grid-layout
のコード例import React from 'react'; import GridLayout from 'react-grid-layout'; const layout = [ { i: 'a', x: 0, y: 0, w: 1, h: 2 }, { i: 'b', x: 1, y: 0, w: 1, h: 2 }, { i: 'c', x: 2, y: 0, w: 1, h: 2 }, ]; const GridLayoutExample = () => { return ( <GridLayout layout={layout} cols={3} rowHeight={30} width={300}> <div key="a" style={{ background: 'lightcoral' }}>A</div> <div key="b" style={{ background: 'lightblue' }}>B</div> <div key="c" style={{ background: 'lightgreen' }}>C</div> </GridLayout> ); }; export default GridLayoutExample;
- react-split-pane:
react-split-pane
のコード例import React from 'react'; import SplitPane from 'react-split-pane'; const SplitPaneExample = () => { return ( <SplitPane split="vertical" minSize={50} defaultSize={200}> <div>左側のパネル</div> <div>右側のパネル</div> </SplitPane> ); }; export default SplitPaneExample;
- flexlayout-react:
flexlayout-react
のコード例import React from 'react'; import { FlexLayout } from 'flexlayout-react'; const layoutConfig = { global: {}, borders: [], layout: { type: 'row', children: [ { type: 'tab', name: 'Tab 1', component: 'component1', }, { type: 'tab', name: 'Tab 2', component: 'component2', }, ], }, }; const App = () => { return <FlexLayout layout={layoutConfig} />; }; export default App;
- react-mosaic-component:
react-mosaic-component
のコード例import React from 'react'; import { Mosaic, MosaicNode } from 'react-mosaic-component'; const mosaicId = 'mosaic'; const initialLayout = { direction: 'row', first: { direction: 'column', first: 'A', second: 'B', }, second: 'C', }; const MosaicExample = () => { return ( <Mosaic id={mosaicId} initialValue={initialLayout} renderTile={(id) => <div>{id}</div>} /> ); }; export default MosaicExample;
- react-flexbox-grid:
react-flexbox-grid
のコード例import React from 'react'; import { Container, Row, Col } from 'react-flexbox-grid'; const FlexboxGridExample = () => { return ( <Container> <Row> <Col xs={12} sm={6} md={4}>カラム 1</Col> <Col xs={12} sm={6} md={4}>カラム 2</Col> <Col xs={12} sm={6} md={4}>カラム 3</Col> </Row> </Container> ); }; export default FlexboxGridExample;