여유 있는 밀도(spacious)The spacious density
density: 'spacious'는 행 48px·머리글 52px·여백 16px에 줄무늬 없이, 세로선은 그대로 두고 둥근 틀과 옅은 그림자로 그려요. 다른 밀도는 그대로예요.density: 'spacious' draws 48px rows, a 52px header and 16px padding, with no stripes and the column lines kept, in a rounded frame with a soft shadow. The other densities are unchanged.
코드Code
탭을 골라 코드를 복사하세요. 위 화면은 이 코드를 그대로 실행한 결과예요.Pick a tab and copy the code. The preview above runs exactly this code.
버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<div id="app">
<div class="toolbar">
<select aria-label="밀도" id="density">
<option value="compact">촘촘하게</option>
<option value="normal">보통</option>
<option value="comfortable">넉넉하게</option>
<option value="spacious" selected>여유 있게</option>
</select>
</div>
<div id="grid" style="height: 420px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('density').addEventListener('change', (event) => actions.density(api, event.target.value));// 영어 페이지는 컬럼 제목과 데이터도 영어로 보여요.
const en = document.documentElement.dataset.lang === 'en';
const names = en
? ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper']
: ['김민준', '이서연', '박지호', '최유나', '정도윤', '한소희', '오세훈', '김서윤'];
const depts = en
? ['Dev', 'Design', 'Sales', 'People']
: ['개발팀', '디자인팀', '영업팀', '인사팀'];
export const options = {
columns: [
{ id: 'name', title: en ? 'Name' : '이름', width: 150 },
{ id: 'dept', title: en ? 'Team' : '부서', width: 140 },
{
id: 'salary',
title: en ? 'Pay' : '월급(만원)',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString(en ? 'en-US' : 'ko-KR'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4],
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 행 48px·머리글 52px·여백 16px, 세로선은 그대로 두고 둥근 틀에 옅은 그림자를 더해요.
density: 'spacious',
};
export const actions = {
// 밀도만 바꿔요. 행·머리글 높이는 spacious일 때만 기본값이 커져요(rowHeight를 주면 그 값이 이겨요).
density: (api, value) => {
if (value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious')
api.setOptions({ density: value });
},
};<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>여유 있는 밀도(spacious)</title>
</head>
<body>
<div class="toolbar">
<select aria-label="밀도" id="density">
<option value="compact">촘촘하게</option>
<option value="normal">보통</option>
<option value="comfortable">넉넉하게</option>
<option value="spacious" selected>여유 있게</option>
</select>
</div>
<div id="grid" style="height: 420px"></div>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
// 영어 페이지는 컬럼 제목과 데이터도 영어로 보여요.
const en = document.documentElement.dataset.lang === 'en';
const names = en
? ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper']
: ['김민준', '이서연', '박지호', '최유나', '정도윤', '한소희', '오세훈', '김서윤'];
const depts = en
? ['Dev', 'Design', 'Sales', 'People']
: ['개발팀', '디자인팀', '영업팀', '인사팀'];
const options = {
columns: [
{ id: 'name', title: en ? 'Name' : '이름', width: 150 },
{ id: 'dept', title: en ? 'Team' : '부서', width: 140 },
{
id: 'salary',
title: en ? 'Pay' : '월급(만원)',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString(en ? 'en-US' : 'ko-KR'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4],
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 행 48px·머리글 52px·여백 16px, 세로선은 그대로 두고 둥근 틀에 옅은 그림자를 더해요.
density: 'spacious',
};
const actions = {
// 밀도만 바꿔요. 행·머리글 높이는 spacious일 때만 기본값이 커져요(rowHeight를 주면 그 값이 이겨요).
density: (api, value) => {
if (value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious')
api.setOptions({ density: value });
},
};
options.ariaLabel = "여유 있는 밀도(spacious)";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
document.getElementById('density').addEventListener('change', (event) => actions.density(api, event.target.value));
</script>
</body>
</html>버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
return (
<>
<div className="toolbar">
<select
aria-label="밀도"
disabled={!api}
onChange={(event) => api && actions.density(api, event.target.value)}
>
<option value="compact">촘촘하게</option>
<option value="normal">보통</option>
<option value="comfortable">넉넉하게</option>
<option value="spacious">여유 있게</option>
</select>
</div>
<Grid style={{ height: 420 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
// 영어 페이지는 컬럼 제목과 데이터도 영어로 보여요.
const en = document.documentElement.dataset.lang === 'en';
const names = en
? ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper']
: ['김민준', '이서연', '박지호', '최유나', '정도윤', '한소희', '오세훈', '김서윤'];
const depts = en
? ['Dev', 'Design', 'Sales', 'People']
: ['개발팀', '디자인팀', '영업팀', '인사팀'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: en ? 'Name' : '이름', width: 150 },
{ id: 'dept', title: en ? 'Team' : '부서', width: 140 },
{
id: 'salary',
title: en ? 'Pay' : '월급(만원)',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString(en ? 'en-US' : 'ko-KR'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 행 48px·머리글 52px·여백 16px, 세로선은 그대로 두고 둥근 틀에 옅은 그림자를 더해요.
density: 'spacious',
};
export const actions = {
// 밀도만 바꿔요. 행·머리글 높이는 spacious일 때만 기본값이 커져요(rowHeight를 주면 그 값이 이겨요).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<script setup lang="ts">
import { shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
}
</script>
<template>
<div class="toolbar">
<select
aria-label="밀도"
:disabled="!api"
@change="api && actions.density(api, ($event.target as HTMLSelectElement).value)"
>
<option value="compact">촘촘하게</option>
<option value="normal">보통</option>
<option value="comfortable">넉넉하게</option>
<option value="spacious" selected>여유 있게</option>
</select>
</div>
<Grid style="height: 420px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
// 영어 페이지는 컬럼 제목과 데이터도 영어로 보여요.
const en = document.documentElement.dataset.lang === 'en';
const names = en
? ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper']
: ['김민준', '이서연', '박지호', '최유나', '정도윤', '한소희', '오세훈', '김서윤'];
const depts = en
? ['Dev', 'Design', 'Sales', 'People']
: ['개발팀', '디자인팀', '영업팀', '인사팀'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: en ? 'Name' : '이름', width: 150 },
{ id: 'dept', title: en ? 'Team' : '부서', width: 140 },
{
id: 'salary',
title: en ? 'Pay' : '월급(만원)',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString(en ? 'en-US' : 'ko-KR'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 행 48px·머리글 52px·여백 16px, 세로선은 그대로 두고 둥근 틀에 옅은 그림자를 더해요.
density: 'spacious',
};
export const actions = {
// 밀도만 바꿔요. 행·머리글 높이는 spacious일 때만 기본값이 커져요(rowHeight를 주면 그 값이 이겨요).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Component } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="밀도"
[disabled]="!api"
(change)="api && actions.density(api, $any($event.target).value)"
>
<option value="compact">촘촘하게</option>
<option value="normal">보통</option>
<option value="comfortable">넉넉하게</option>
<option value="spacious" selected>여유 있게</option>
</select>
</div>
<mx-grid style="height: 420px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
}
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
// 영어 페이지는 컬럼 제목과 데이터도 영어로 보여요.
const en = document.documentElement.dataset.lang === 'en';
const names = en
? ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper']
: ['김민준', '이서연', '박지호', '최유나', '정도윤', '한소희', '오세훈', '김서윤'];
const depts = en
? ['Dev', 'Design', 'Sales', 'People']
: ['개발팀', '디자인팀', '영업팀', '인사팀'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: en ? 'Name' : '이름', width: 150 },
{ id: 'dept', title: en ? 'Team' : '부서', width: 140 },
{
id: 'salary',
title: en ? 'Pay' : '월급(만원)',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString(en ? 'en-US' : 'ko-KR'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 행 48px·머리글 52px·여백 16px, 세로선은 그대로 두고 둥근 틀에 옅은 그림자를 더해요.
density: 'spacious',
};
export const actions = {
// 밀도만 바꿔요. 행·머리글 높이는 spacious일 때만 기본값이 커져요(rowHeight를 주면 그 값이 이겨요).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<div id="app">
<div class="toolbar">
<select aria-label="Density" id="density">
<option value="compact">Compact</option>
<option value="normal">Normal</option>
<option value="comfortable">Comfortable</option>
<option value="spacious" selected>Spacious</option>
</select>
</div>
<div id="grid" style="height: 420px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('density').addEventListener('change', (event) => actions.density(api, event.target.value));const names = ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper'];
const depts = ['Dev', 'Design', 'Sales', 'People'];
export const options = {
columns: [
{ id: 'name', title: 'Name', width: 150 },
{ id: 'dept', title: 'Team', width: 140 },
{
id: 'salary',
title: 'Pay',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString('en-US'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4],
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 48px rows, 52px header, 16px padding; vertical lines stay and a soft shadow is added to the rounded frame.
density: 'spacious',
};
export const actions = {
// Change only the density. Row and header heights get larger defaults only for spacious (an explicit rowHeight wins).
density: (api, value) => {
if (value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious')
api.setOptions({ density: value });
},
};<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>The spacious density</title>
</head>
<body>
<div class="toolbar">
<select aria-label="Density" id="density">
<option value="compact">Compact</option>
<option value="normal">Normal</option>
<option value="comfortable">Comfortable</option>
<option value="spacious" selected>Spacious</option>
</select>
</div>
<div id="grid" style="height: 420px"></div>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const names = ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper'];
const depts = ['Dev', 'Design', 'Sales', 'People'];
const options = {
columns: [
{ id: 'name', title: 'Name', width: 150 },
{ id: 'dept', title: 'Team', width: 140 },
{
id: 'salary',
title: 'Pay',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString('en-US'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4],
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 48px rows, 52px header, 16px padding; vertical lines stay and a soft shadow is added to the rounded frame.
density: 'spacious',
};
const actions = {
// Change only the density. Row and header heights get larger defaults only for spacious (an explicit rowHeight wins).
density: (api, value) => {
if (value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious')
api.setOptions({ density: value });
},
};
options.ariaLabel = "The spacious density";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
document.getElementById('density').addEventListener('change', (event) => actions.density(api, event.target.value));
</script>
</body>
</html>When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
return (
<>
<div className="toolbar">
<select
aria-label="Density"
disabled={!api}
onChange={(event) => api && actions.density(api, event.target.value)}
>
<option value="compact">Compact</option>
<option value="normal">Normal</option>
<option value="comfortable">Comfortable</option>
<option value="spacious">Spacious</option>
</select>
</div>
<Grid style={{ height: 420 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
const names = ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper'];
const depts = ['Dev', 'Design', 'Sales', 'People'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 150 },
{ id: 'dept', title: 'Team', width: 140 },
{
id: 'salary',
title: 'Pay',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString('en-US'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 48px rows, 52px header, 16px padding; vertical lines stay and a soft shadow is added to the rounded frame.
density: 'spacious',
};
export const actions = {
// Change only the density. Row and header heights get larger defaults only for spacious (an explicit rowHeight wins).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<script setup lang="ts">
import { shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
}
</script>
<template>
<div class="toolbar">
<select
aria-label="Density"
:disabled="!api"
@change="api && actions.density(api, ($event.target as HTMLSelectElement).value)"
>
<option value="compact">Compact</option>
<option value="normal">Normal</option>
<option value="comfortable">Comfortable</option>
<option value="spacious" selected>Spacious</option>
</select>
</div>
<Grid style="height: 420px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
const names = ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper'];
const depts = ['Dev', 'Design', 'Sales', 'People'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 150 },
{ id: 'dept', title: 'Team', width: 140 },
{
id: 'salary',
title: 'Pay',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString('en-US'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 48px rows, 52px header, 16px padding; vertical lines stay and a soft shadow is added to the rounded frame.
density: 'spacious',
};
export const actions = {
// Change only the density. Row and header heights get larger defaults only for spacious (an explicit rowHeight wins).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Component } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="Density"
[disabled]="!api"
(change)="api && actions.density(api, $any($event.target).value)"
>
<option value="compact">Compact</option>
<option value="normal">Normal</option>
<option value="comfortable">Comfortable</option>
<option value="spacious" selected>Spacious</option>
</select>
</div>
<mx-grid style="height: 420px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
}
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export interface Row {
id: number;
name: string;
dept: string;
salary: number;
}
const names = ['Alex', 'Blair', 'Casey', 'Drew', 'Emery', 'Finn', 'Gray', 'Harper'];
const depts = ['Dev', 'Design', 'Sales', 'People'];
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 150 },
{ id: 'dept', title: 'Team', width: 140 },
{
id: 'salary',
title: 'Pay',
kind: 'number',
width: 130,
align: 'end',
formatValue: (value) => Number(value).toLocaleString('en-US'),
},
],
rows: names.map((name, i) => ({
id: i + 1,
name,
dept: depts[i % 4] as string,
salary: 320 + i * 41,
})),
rowKey: 'id',
// spacious: 48px rows, 52px header, 16px padding; vertical lines stay and a soft shadow is added to the rounded frame.
density: 'spacious',
};
export const actions = {
// Change only the density. Row and header heights get larger defaults only for spacious (an explicit rowHeight wins).
density: (api: GridApi<Row>, value?: string) => {
if (
value === 'compact' ||
value === 'normal' ||
value === 'comfortable' ||
value === 'spacious'
)
api.setOptions({ density: value });
},
};