8.8k GitHub stars and counting β prevwong/craft.js is a TypeScript project TopGit is tracking across repositories on the platform. π A React Framework for building extensible drag and drop page editors
Snapshot summary built from the project's own GitHub metadata β there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then β see the READ ME tab for the original README in full.
Page editors are a great way to provide an excellent user experience. However, to build one is often a pretty dreadful task.
There're existing libraries that come with a fully working page editor out of the box with a user interface and editable components. However, if you wish to make customisations such as modifying the user interface and its behavior, it will most definitely involve modifying the library itself.
Craft.js solves this problem by modularising the building blocks of a page editor. It ships with a drag-n-drop system and handles the way user components should be rendered, updated and moved - among other things. With this, you'll be able to build your own page editor exactly how you want it to look and behave.
Docs
Core concepts
Tutorial
API Reference
Examples
These examples should give you an idea on the flexibility of Craft.js.
Both these examples look very different from each other, with very different UI. But they are both built with Craft.js! π€―
Landing
Basic
Features :fire:
It's just React
No need for complicated plugin systems. Design your editor from top to bottom the same way as you would design any other frontend application in React.
A simple user component can easily be defined as such:
Heck, the entire UI of your page editor is built using just React.
import React from "react";
import { Editor, Frame, Element } from "@craftjs/core";
const App = () => {
return (
<div>
<header>Some fancy header or whatever</header>
<Editor>
// Editable area starts here
<Frame resolver={{ TextComponent, Container }}>
<Element canvas is={TextComponent} text="I'm already rendered here" />
</Frame>
</Editor>
</div>
);
};
Control how your components are edited
An obvious requirement for page editors is that they need to allow users to edit components. With Craft.js, you control the process of which these components should be edited.
In the following example, when the user clicks on a component, we'll display a modal that requires the user to input a value for the text prop. As the input value changes, the component will be re-rendered with updated prop.
With this, you could easily implement content editable text or drag-to-resize components, just as any modern page editor would have.
User components with droppable regions
Let's say we need a "Container" component which users can drop into the editor. Additionally, we would also like them to be able to drag and drop other components into the Container.
In Craft.js, it's as simple as calling the <Canvas />
import {useNode} from "@craftjs/core";
const Container = () => {
const { connectors: {drag} } = useNode();
return (
<div ref={drag}>
<Canvas id="drop_section">
// Now users will be able to drag/drop components into this section
<TextComponent />
</Canvas>
</div>
)
}
Extensible
Craft.js provides an expressive API which allows you to easily read and manipulate the editor state. Let's say you would like to implement a copy function for a component:
β You want to design your page editor according to your own UI specifications. With Craft.js, you control almost every aspect of the look and feel of your page editor.
β You like the React ecosystem. Being a React framework, not only do you get to build your user interface declaratively, but you will also be able to extend upon thousands of existing React components for your page editor.
β You're the coolest kid in class π
You should not use this if:
β You need a page editor that works out of the box. Craft.js is an abstraction where you implement your own page editor upon. For example, it does not come with a ready-made user interface.
However, you could still consider using the examples as a starting point.
Additional Packages :tada:
@craftjs/layers A Photoshop-like layers panel
Acknowledgements :raised_hands:
react-dnd The React drag-n-drop library.
Although it is not actually used here, many aspects of Craft.js are written with react-dnd as a reference along with some utilities and functions being borrowed.
Grape.js The HTML web builder framework. This has served as an inspiration for Craft.js. The element positioning logic used in Craft.js is borrowed from Grape.js
use-methods A super handy hook when dealing with reducers. Craft.js uses a slightly modified version of use-methods to better fit our API.
Getting Help :wave:
If you have questions or there's something you'd like to discuss (eg: contributing), please head over to our Discord server.
Sponsor :heart_decoration:
Craft.js is released under the MIT license and is built with 100% love. If you found it useful and would like to ensure its continued development, please consider becoming a backer/sponsor or making a one-time donation via Github Sponsor, Open Collective or Ko-fi.
How does prevwong/craft.js compare to other Frontend projects?
prevwong/craft.js is tracked by TopGit in the Frontend category, with 8.8k GitHub stars and written in TypeScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
Is prevwong/craft.js open source?
Yes β prevwong/craft.js ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/prevwong/craft.js.
What else is in the Frontend space?
prevwong/craft.js is tracked by TopGit under the Frontend category, alongside 8 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is prevwong/craft.js?
prevwong/craft.js (prevwong/craft.js) is a TypeScript project on GitHub. From the project's own README: π A React Framework for building extensible drag and drop page editors
Where do I read more about prevwong/craft.js?
This TopGit page is a snapshot β the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/prevwong/craft.js is the definitive source.
Why is prevwong/craft.js categorized under Frontend?
TopGit places prevwong/craft.js in the Frontend category based on its GitHub topics and description (tagged: "draft-js", "drag-and-drop", "html-builder"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.
Curious whether craft.js is right for you?
Let ChatGPT, Claude, or Perplexity look into it β click below and see what AI actually says about craft.js.