A simple JavaScript framework for Drawing on the web.(一个面向Web绘图的JavaScript框架)
Find a file
2025-09-13 18:02:49 +08:00
.github/workflows ci: update action scripts 2025-09-06 13:55:51 +08:00
.vscode chore: init eslint v9 2025-09-06 13:30:13 +08:00
__tests__ test: update unit test and e2e test 2023-04-02 12:10:48 +08:00
assets docs: add idraw.js logo 2023-12-24 16:53:17 +08:00
packages deps: bump npm deps 2025-09-06 13:16:34 +08:00
scripts chore: improve build scripts 2025-09-06 13:39:47 +08:00
.eslintrc.js feat: init deep selector middleware 2023-06-10 18:09:11 +08:00
.gitignore build: add output esm/* to @idraw/util 2022-02-27 15:56:32 +08:00
.npmrc chore: update npmrc 2024-05-19 19:21:05 +08:00
.prettierrc.json chore: improve prettier and eslint config 2025-09-06 18:51:20 +08:00
babel.config.js feat: init project 2021-05-23 20:16:15 +08:00
dev.md chore: update testing script 2021-06-10 12:02:08 +08:00
eslint.config.mjs chore: improve prettier and eslint config 2025-09-06 18:51:20 +08:00
jest.config.js feat: add history and fix text-editor middleware 2025-05-10 15:20:55 +08:00
jest.cover.js test: improve e2e test 2023-02-12 14:44:56 +08:00
jest.e2e.config.js test: update unit test and e2e test 2023-04-02 12:10:48 +08:00
jest.setup.js feat: add history and fix text-editor middleware 2025-05-10 15:20:55 +08:00
LICENSE doc: update LICENSE 2023-02-25 13:49:19 +08:00
package.json chore: bump deps 2025-09-13 18:02:49 +08:00
pnpm-lock.yaml chore: bump deps 2025-09-13 18:02:49 +08:00
pnpm-workspace.yaml feat: add studio to project 2023-05-20 10:08:25 +08:00
README.md chore: bump version 0.4.0-beta.25 2024-06-02 13:27:18 +08:00
tsconfig.json chore: improve build script 2023-02-12 11:39:24 +08:00
tsconfig.node.json deps: upgrade pkg 2023-09-16 21:22:28 +08:00
tsconfig.web.json feat: add history and fix text-editor middleware 2025-05-10 15:20:55 +08:00

iDraw.js Logo

iDraw.js

iDraw.js is a simple JavaScript framework for Drawing on the web.

一个面向Web绘图的JavaScript框架

idrawjs.com

CI Version License


Sponsors

iDraw.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider sponsoring iDrawjs's development.

Become a Backer

@idraw/studio Preview

The preview of @idraw/studo. Click here to get it.

idraw-studio-light-theme idraw-studio-dark-theme

Install

npm i idraw

Getting Started

Common

import { iDraw } from 'idraw';

const idraw = new iDraw(
  document.querySelector('#app'),
  {
    width: 600,
    height: 400,
    devicePixelRatio: 1,
  }
);
idraw.addElement({
  name: "rect-1",
  x: 140,
  y: 120,
  w: 200,
  h: 100,
  type: "rect",
  detail: {
    background: "#f7d3c1",
    borderRadius: 20,
    borderWidth: 4,
    borderColor: "#ff6032",
  },
});

React

import { iDraw } from 'idraw';
import { useEffect, useRef } from 'react';

function Demo() {
  const ref = useRef(null);
  useEffect(() => {
    const idraw = new iDraw(ref.current, {
      width: 600,
      height: 400, 
      devicePixelRatio: 1,
    });
    idraw.addElement({
      name: "rect-001",
      x: 140,
      y: 120,
      w: 200,
      h: 100,
      type: "rect",
      detail: {
        background: "#f7d3c1",
        borderRadius: 20,
        borderWidth: 4,
        borderColor: "#ff6032",
      },
    })
  }, []);

  return (
    <div ref={ref}></div>
  )
}

Vue

<template>
  <div ref="mount"></div>
</template>

<script setup >
import { iDraw } from 'idraw';
import { ref, onMounted } from 'vue'
const mount = ref();

onMounted(() => {
  const idraw = new iDraw(mount.value, {
    width: 600,
    height: 400, 
    devicePixelRatio: 1,
  });
  idraw.addElement({
    name: "rect-001",
    x: 140,
    y: 120,
    w: 200,
    h: 100,
    type: "rect",
    detail: {
      background: "#f7d3c1",
      borderRadius: 20,
      borderWidth: 4,
      borderColor: "#ff6032",
    },
  })
})
</script>

Contributing

We appreciate your help!

To contribute, please follow the steps:

  • git clone git@github.com:idrawjs/idraw.git
  • cd idraw
  • pnpm i
  • npm run dev