본문으로 건너뛰기Skip to content
예제 첫화면Examples home

펼침 아이콘과 안내선 바꾸기Change the expand icons and guide lines

화살표 대신 폴더, +/- 같은 기본 아이콘 세트를 고르거나 열림·닫힘·잎 아이콘을 직접 정할 수 있어요. 들여쓰기 안내선의 종류와 모양도 바꿀 수 있어요.Pick a built-in icon set such as folder or +/-, or define the open, closed and leaf icons yourself. The indent guide lines can change too.

입문Beginner
직접 써 보기Live preview펼침 아이콘과 안내선 바꾸기Change the expand icons and guide lines

코드Code

탭을 골라 코드를 복사하세요. 위 화면은 이 코드를 그대로 실행한 결과예요.Pick a tab and copy the code. The preview above runs exactly this code.

이 화면은 새 모양 옵션을 켠 모양이에요: density: 'spacious', iconStyle: 'soft', motion: true (코드에 없으면 기본 모양으로 보여요)This preview has the new-look options on: density: 'spacious', iconStyle: 'soft', motion: true (without them in your code you get the default look)

빌드 도구(Vite 등)를 쓰는 프로젝트용 모듈 파일이에요. 설치 없이 바로 돌려 보려면 HTML 탭이나 직접 해보기를 쓰세요.

버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.

index.html
<div id="app">
  <div class="toolbar">
    <select aria-label="펼침 아이콘" id="icon">
      <option value="arrow" selected>화살표</option>
      <option value="folder">폴더</option>
      <option value="plusMinus">+ / -</option>
      <option value="plusMinusCircle">원 안의 + / -</option>
      <option value="emoji">직접 정한 아이콘</option>
    </select>
    <select aria-label="안내선" id="guides">
      <option value="dotted" selected>점선</option>
      <option value="solid">실선</option>
      <option value="off">없음</option>
    </select>
    <select aria-label="안내선 모양" id="shape">
      <option value="branch" selected>가지선</option>
      <option value="vertical">세로선만</option>
    </select>
  </div>
  <div id="grid" style="height: 430px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('icon').addEventListener('change', (event) => actions.icon(api, event.target.value));
document.getElementById('guides').addEventListener('change', (event) => actions.guides(api, event.target.value));
document.getElementById('shape').addEventListener('change', (event) => actions.shape(api, event.target.value));
example.js
const rows = [
  {
    id: 'T1',
    parentId: null,
    task: '출시 준비',
    owner: '김서연',
    start: '2026-11-02',
    end: '2026-12-18',
  },
  {
    id: 'T10',
    parentId: 'T1',
    task: '기획',
    owner: '이준호',
    start: '2026-11-02',
    end: '2026-11-13',
  },
  {
    id: 'T11',
    parentId: 'T10',
    task: '요구사항 정리',
    owner: '이준호',
    start: '2026-11-02',
    end: '2026-11-06',
  },
  {
    id: 'T12',
    parentId: 'T10',
    task: '화면 설계',
    owner: '박민지',
    start: '2026-11-09',
    end: '2026-11-13',
  },
  {
    id: 'T20',
    parentId: 'T1',
    task: '개발',
    owner: '최도윤',
    start: '2026-11-16',
    end: '2026-12-04',
  },
  {
    id: 'T21',
    parentId: 'T20',
    task: '프런트엔드',
    owner: '정하은',
    start: '2026-11-16',
    end: '2026-11-27',
  },
  {
    id: 'T22',
    parentId: 'T20',
    task: '백엔드',
    owner: '최도윤',
    start: '2026-11-16',
    end: '2026-12-04',
  },
  {
    id: 'T30',
    parentId: 'T1',
    task: '테스트',
    owner: '박민지',
    start: '2026-12-07',
    end: '2026-12-18',
  },
  {
    id: 'T31',
    parentId: 'T30',
    task: '기능 테스트',
    owner: '박민지',
    start: '2026-12-07',
    end: '2026-12-11',
  },
  {
    id: 'T32',
    parentId: 'T30',
    task: '성능 테스트',
    owner: '임태민',
    start: '2026-12-14',
    end: '2026-12-18',
  },
  {
    id: 'T2',
    parentId: null,
    task: '운영 준비',
    owner: '김서연',
    start: '2026-12-07',
    end: '2026-12-23',
  },
  {
    id: 'T40',
    parentId: 'T2',
    task: '교육 자료 작성',
    owner: '한지우',
    start: '2026-12-07',
    end: '2026-12-11',
  },
];
let icon = 'arrow';
let guides = 'dotted';
let shape = 'branch';
// 펼침 아이콘은 세트 이름('folder' 등)으로 고르거나, 열림·닫힘·잎 아이콘을 직접 정할 수 있어요.
const toggleIcon = () => icon === 'emoji' ? { expanded: '📂', collapsed: '📁', leaf: '📄' } : icon;
const tree = () => ({
  parentKey: 'parentId',
  column: 'task',
  expandDepth: 'all',
  toggleIcon: toggleIcon(),
  guides,
  guideStyle: shape,
});
export const options = {
  columns: [
    { id: 'task', title: '작업', width: 220 },
    { id: 'owner', title: '담당자', width: 100 },
    { id: 'start', title: '시작', width: 110 },
    { id: 'end', title: '종료', width: 110 },
  ],
  rows,
  rowKey: 'id',
  tree: tree(),
};
export const actions = {
  icon: (api, value) => {
    icon = (value ?? 'arrow');
    api.setOptions({ tree: tree() });
  },
  guides: (api, value) => {
    guides = value === 'off' ? false : value === 'solid' ? 'solid' : 'dotted';
    api.setOptions({ tree: tree() });
  },
  shape: (api, value) => {
    shape = value === 'vertical' ? 'vertical' : 'branch';
    api.setOptions({ tree: tree() });
  },
};

Module files for a project with a bundler such as Vite. To run it with no setup, use the HTML tab or Try it.

When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.

index.html
<div id="app">
  <div class="toolbar">
    <select aria-label="Expand icon" id="icon">
      <option value="arrow" selected>Arrow</option>
      <option value="folder">Folder</option>
      <option value="plusMinus">Plus / minus</option>
      <option value="plusMinusCircle">Circled plus / minus</option>
      <option value="emoji">Custom icons</option>
    </select>
    <select aria-label="Guide lines" id="guides">
      <option value="dotted" selected>Dotted</option>
      <option value="solid">Solid</option>
      <option value="off">None</option>
    </select>
    <select aria-label="Guide shape" id="shape">
      <option value="branch" selected>Branch</option>
      <option value="vertical">Vertical only</option>
    </select>
  </div>
  <div id="grid" style="height: 430px"></div>
</div>
<script type="module" src="./main.js"></script>
main.js
import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('icon').addEventListener('change', (event) => actions.icon(api, event.target.value));
document.getElementById('guides').addEventListener('change', (event) => actions.guides(api, event.target.value));
document.getElementById('shape').addEventListener('change', (event) => actions.shape(api, event.target.value));
example.js
const rows = [
  {
    id: 'T1',
    parentId: null,
    task: 'Release',
    owner: 'Emma Stone',
    start: '2026-11-02',
    end: '2026-12-18',
  },
  {
    id: 'T10',
    parentId: 'T1',
    task: 'Planning',
    owner: 'Liam Carter',
    start: '2026-11-02',
    end: '2026-11-13',
  },
  {
    id: 'T11',
    parentId: 'T10',
    task: 'Gather requirements',
    owner: 'Liam Carter',
    start: '2026-11-02',
    end: '2026-11-06',
  },
  {
    id: 'T12',
    parentId: 'T10',
    task: 'Screen design',
    owner: 'Mia Parker',
    start: '2026-11-09',
    end: '2026-11-13',
  },
  {
    id: 'T20',
    parentId: 'T1',
    task: 'Development',
    owner: 'Noah Davis',
    start: '2026-11-16',
    end: '2026-12-04',
  },
  {
    id: 'T21',
    parentId: 'T20',
    task: 'Frontend',
    owner: 'Ava Moore',
    start: '2026-11-16',
    end: '2026-11-27',
  },
  {
    id: 'T22',
    parentId: 'T20',
    task: 'Backend',
    owner: 'Noah Davis',
    start: '2026-11-16',
    end: '2026-12-04',
  },
  {
    id: 'T30',
    parentId: 'T1',
    task: 'Testing',
    owner: 'Mia Parker',
    start: '2026-12-07',
    end: '2026-12-18',
  },
  {
    id: 'T31',
    parentId: 'T30',
    task: 'Functional test',
    owner: 'Mia Parker',
    start: '2026-12-07',
    end: '2026-12-11',
  },
  {
    id: 'T32',
    parentId: 'T30',
    task: 'Performance test',
    owner: 'Ethan Lee',
    start: '2026-12-14',
    end: '2026-12-18',
  },
  {
    id: 'T2',
    parentId: null,
    task: 'Operations prep',
    owner: 'Emma Stone',
    start: '2026-12-07',
    end: '2026-12-23',
  },
  {
    id: 'T40',
    parentId: 'T2',
    task: 'Write training materials',
    owner: 'Grace Hall',
    start: '2026-12-07',
    end: '2026-12-11',
  },
];
let icon = 'arrow';
let guides = 'dotted';
let shape = 'branch';
// Pick the expand icon by set name ('folder' and so on), or define the open, closed and leaf icons yourself.
const toggleIcon = () => icon === 'emoji' ? { expanded: '📂', collapsed: '📁', leaf: '📄' } : icon;
const tree = () => ({
  parentKey: 'parentId',
  column: 'task',
  expandDepth: 'all',
  toggleIcon: toggleIcon(),
  guides,
  guideStyle: shape,
});
export const options = {
  columns: [
    { id: 'task', title: 'Task', width: 220 },
    { id: 'owner', title: 'Owner', width: 120 },
    { id: 'start', title: 'Start', width: 110 },
    { id: 'end', title: 'End', width: 110 },
  ],
  rows,
  rowKey: 'id',
  tree: tree(),
};
export const actions = {
  icon: (api, value) => {
    icon = (value ?? 'arrow');
    api.setOptions({ tree: tree() });
  },
  guides: (api, value) => {
    guides = value === 'off' ? false : value === 'solid' ? 'solid' : 'dotted';
    api.setOptions({ tree: tree() });
  },
  shape: (api, value) => {
    shape = value === 'vertical' ? 'vertical' : 'branch';
    api.setOptions({ tree: tree() });
  },
};