A content-aware adaptive drag-and-drop layout engine for modern apps.
Project details
DnDGem revolutionizes the way applications manage layouts with its advanced adaptive drag-and-drop features. Built with content-aware constraints and deterministic solving, it ensures that not only does content fit geometrically, but also meets practical usability needs. Easy to integrate and framework-agnostic, DnDGem is the solution for dynamic dashboard-style interfaces.
DnDGem is a versatile drag-and-drop framework designed to create sophisticated, content-aware dashboard layouts. This innovative engine employs content-aware constraints, deterministic solving, and adaptive reflow, allowing for layouts that prioritize not just geometric fit, but also the utility of content.
Note: A layout that geometrically fits does not necessarily ensure the content remains useful.
@dndgem/core: A renderer-agnostic package focused on domain, validity, and solving.@dndgem/dom: Provides DOM measurement, resizing, and drag support.@dndgem/react, @dndgem/vue, @dndgem/angular, @dndgem/svelte.Here is a brief illustration of how to utilize DnDGem with React:
import { DnDGemProvider, useDnDGemContainer, useDnDGemItem } from '@dndgem/react';
function Board() {
const containerRef = useDnDGemContainer();
const revenue = useDnDGemItem('revenue');
return (
<div ref={containerRef} style={{ position: 'relative', width: 480, height: 240 }}>
<article ref={revenue.ref} style={{ background: '#2f6f5e', color: '#fff', ...revenue.style }}>
Revenue
</article>
</div>
);
}
export function App() {
return (
<DnDGemProvider
items={[
{ id: 'revenue', constraints: { minWidth: 96, minUsefulWidth: 140, preferredWidth: 180 } },
]}
desiredPlacements={{ revenue: { x: 12, y: 12, width: 180, height: 88 } }}
>
<Board />
</DnDGemProvider>
);
}
DnDGem is currently in public alpha phase, with ongoing development and community feedback actively encouraged. The engine is open source and can be accessed on GitHub. For live experimentation, explore the playground.
Explore the potential of DnDGem to elevate the interactivity and usability of modern web applications.
Comments
0Start the conversation
Share the first comment.