좁은 화면에서는 아래 시트로A bottom sheet on narrow screens
combobox 목록은 좁은 화면이나 낮은 터치 화면에서 날짜 선택기처럼 아래에서 올라오는 시트로 열려요. 항목은 44px 이상이고 어두운 막을 누르면 목록만 닫혀요. 넓은 화면에서는 셀 아래 팝업이고 자리가 모자라면 위로 뒤집혀요.On a narrow or low touch screen the combobox list opens as a bottom sheet like the date picker. Items are at least 44px and pressing the dark backdrop closes only the list. On a wide screen it is a popup below the cell that flips above when there is no room.
코드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)
버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<div id="app">
<div id="grid" style="height: 260px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);const COUNTRIES = [
'대한민국',
'일본',
'중국',
'미국',
'캐나다',
'멕시코',
'브라질',
'영국',
'프랑스',
'독일',
'이탈리아',
'스페인',
'인도',
'호주',
'뉴질랜드',
'베트남',
'태국',
'싱가포르',
].map((value) => ({ value }));
const rows = [
{ id: 1, name: '김하늘', country: '대한민국' },
{ id: 2, name: '이도윤', country: '' },
{ id: 3, name: '박서연', country: '일본' },
];
// 좁은 화면(520px 이하)이나 낮은 터치 화면에서는 목록이 아래에서 올라오는 시트로 열려요.
// 항목은 44px 이상이고, 어두운 막을 누르면 목록만 닫혀요. 데스크톱에서는 셀 아래 팝업이에요.
export const options = {
columns: [
{ id: 'name', title: '이름', width: 110 },
{
id: 'country',
title: '국가',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: '국가 검색', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api, log) {
log({
ko: '창을 좁히거나 휴대폰에서 "국가" 칸을 두 번 눌러 보세요. 목록이 아래 시트로 열려요.',
en: 'Narrow the window or use a phone and double-click a "국가" (country) cell. The list opens as a bottom sheet.',
});
const offs = [
api.on('editCommitted', (e) => log({
ko: `행 ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
en: `Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
})),
];
return () => offs.forEach((off) => off());
}<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>좁은 화면에서는 아래 시트로</title>
</head>
<body>
<div id="grid" style="height: 260px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const COUNTRIES = [
'대한민국',
'일본',
'중국',
'미국',
'캐나다',
'멕시코',
'브라질',
'영국',
'프랑스',
'독일',
'이탈리아',
'스페인',
'인도',
'호주',
'뉴질랜드',
'베트남',
'태국',
'싱가포르',
].map((value) => ({ value }));
const rows = [
{ id: 1, name: '김하늘', country: '대한민국' },
{ id: 2, name: '이도윤', country: '' },
{ id: 3, name: '박서연', country: '일본' },
];
// 좁은 화면(520px 이하)이나 낮은 터치 화면에서는 목록이 아래에서 올라오는 시트로 열려요.
// 항목은 44px 이상이고, 어두운 막을 누르면 목록만 닫혀요. 데스크톱에서는 셀 아래 팝업이에요.
const options = {
columns: [
{ id: 'name', title: '이름', width: 110 },
{
id: 'country',
title: '국가',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: '국가 검색', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
function setup(api, log) {
log({
ko: '창을 좁히거나 휴대폰에서 "국가" 칸을 두 번 눌러 보세요. 목록이 아래 시트로 열려요.',
en: 'Narrow the window or use a phone and double-click a "국가" (country) cell. The list opens as a bottom sheet.',
});
const offs = [
api.on('editCommitted', (e) => log({
ko: `행 ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
en: `Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
})),
];
return () => offs.forEach((off) => off());
}
options.ariaLabel = "좁은 화면에서는 아래 시트로";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
setup(api, (message) => {
const item = document.createElement('li');
item.textContent =
typeof message === 'string' ? message : navigator.language.startsWith('ko') ? message.ko : message.en;
document.getElementById('log').prepend(item);
});
</script>
</body>
</html>버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { useEffect } from 'react';
import { Grid, useGridApi } from '@maxgrid/react';
import { options, setup, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
useEffect(() => (api ? setup(api, console.log) : undefined), [api]);
return (
<>
<Grid style={{ height: 260 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'대한민국',
'일본',
'중국',
'미국',
'캐나다',
'멕시코',
'브라질',
'영국',
'프랑스',
'독일',
'이탈리아',
'스페인',
'인도',
'호주',
'뉴질랜드',
'베트남',
'태국',
'싱가포르',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: '김하늘', country: '대한민국' },
{ id: 2, name: '이도윤', country: '' },
{ id: 3, name: '박서연', country: '일본' },
];
// 좁은 화면(520px 이하)이나 낮은 터치 화면에서는 목록이 아래에서 올라오는 시트로 열려요.
// 항목은 44px 이상이고, 어두운 막을 누르면 목록만 닫혀요. 데스크톱에서는 셀 아래 팝업이에요.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: '이름', width: 110 },
{
id: 'country',
title: '국가',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: '국가 검색', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log({
ko: '창을 좁히거나 휴대폰에서 "국가" 칸을 두 번 눌러 보세요. 목록이 아래 시트로 열려요.',
en: 'Narrow the window or use a phone and double-click a "국가" (country) cell. The list opens as a bottom sheet.',
});
const offs = [
api.on('editCommitted', (e) =>
log({
ko: `행 ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
en: `Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
}),
),
];
return () => offs.forEach((off) => off());
}버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<script setup lang="ts">
import { onBeforeUnmount, shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { options, setup, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
let stop: (() => void) | undefined;
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
stop = setup(event.api, console.log);
}
onBeforeUnmount(() => stop?.());
</script>
<template>
<Grid style="height: 260px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'대한민국',
'일본',
'중국',
'미국',
'캐나다',
'멕시코',
'브라질',
'영국',
'프랑스',
'독일',
'이탈리아',
'스페인',
'인도',
'호주',
'뉴질랜드',
'베트남',
'태국',
'싱가포르',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: '김하늘', country: '대한민국' },
{ id: 2, name: '이도윤', country: '' },
{ id: 3, name: '박서연', country: '일본' },
];
// 좁은 화면(520px 이하)이나 낮은 터치 화면에서는 목록이 아래에서 올라오는 시트로 열려요.
// 항목은 44px 이상이고, 어두운 막을 누르면 목록만 닫혀요. 데스크톱에서는 셀 아래 팝업이에요.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: '이름', width: 110 },
{
id: 'country',
title: '국가',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: '국가 검색', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log({
ko: '창을 좁히거나 휴대폰에서 "국가" 칸을 두 번 눌러 보세요. 목록이 아래 시트로 열려요.',
en: 'Narrow the window or use a phone and double-click a "국가" (country) cell. The list opens as a bottom sheet.',
});
const offs = [
api.on('editCommitted', (e) =>
log({
ko: `행 ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
en: `Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
}),
),
];
return () => offs.forEach((off) => off());
}버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Component, OnDestroy } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { options, setup, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<mx-grid style="height: 260px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent implements OnDestroy {
readonly options = options;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
private stop: (() => void) | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
this.stop = setup(this.api, console.log);
}
}
ngOnDestroy(): void {
this.stop?.();
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'대한민국',
'일본',
'중국',
'미국',
'캐나다',
'멕시코',
'브라질',
'영국',
'프랑스',
'독일',
'이탈리아',
'스페인',
'인도',
'호주',
'뉴질랜드',
'베트남',
'태국',
'싱가포르',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: '김하늘', country: '대한민국' },
{ id: 2, name: '이도윤', country: '' },
{ id: 3, name: '박서연', country: '일본' },
];
// 좁은 화면(520px 이하)이나 낮은 터치 화면에서는 목록이 아래에서 올라오는 시트로 열려요.
// 항목은 44px 이상이고, 어두운 막을 누르면 목록만 닫혀요. 데스크톱에서는 셀 아래 팝업이에요.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: '이름', width: 110 },
{
id: 'country',
title: '국가',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: '국가 검색', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log({
ko: '창을 좁히거나 휴대폰에서 "국가" 칸을 두 번 눌러 보세요. 목록이 아래 시트로 열려요.',
en: 'Narrow the window or use a phone and double-click a "국가" (country) cell. The list opens as a bottom sheet.',
});
const offs = [
api.on('editCommitted', (e) =>
log({
ko: `행 ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
en: `Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`,
}),
),
];
return () => offs.forEach((off) => off());
}When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<div id="app">
<div id="grid" style="height: 260px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { options, setup } from './example';
const api = createGrid(document.getElementById('grid'), options);
setup(api, console.log);const COUNTRIES = [
'South Korea',
'Japan',
'China',
'United States',
'Canada',
'Mexico',
'Brazil',
'United Kingdom',
'France',
'Germany',
'Italy',
'Spain',
'India',
'Australia',
'New Zealand',
'Vietnam',
'Thailand',
'Singapore',
].map((value) => ({ value }));
const rows = [
{ id: 1, name: 'Liam Carter', country: 'South Korea' },
{ id: 2, name: 'Emma Stone', country: '' },
{ id: 3, name: 'Noah Kim', country: 'Japan' },
];
// On a narrow screen (520px or less) or a low touch screen the list opens as a sheet sliding up from the bottom.
// Items are at least 44px, and pressing the dark backdrop closes only the list. On desktop it is a popup below the cell.
export const options = {
columns: [
{ id: 'name', title: 'Name', width: 130 },
{
id: 'country',
title: 'Country',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: 'Search country', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api, log) {
log('Narrow the window or use a phone and double-click a "Country" cell. The list opens as a bottom sheet.');
const offs = [
api.on('editCommitted', (e) => log(`Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`)),
];
return () => offs.forEach((off) => off());
}<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>A bottom sheet on narrow screens</title>
</head>
<body>
<div id="grid" style="height: 260px"></div>
<ul id="log" aria-live="polite"></ul>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const COUNTRIES = [
'South Korea',
'Japan',
'China',
'United States',
'Canada',
'Mexico',
'Brazil',
'United Kingdom',
'France',
'Germany',
'Italy',
'Spain',
'India',
'Australia',
'New Zealand',
'Vietnam',
'Thailand',
'Singapore',
].map((value) => ({ value }));
const rows = [
{ id: 1, name: 'Liam Carter', country: 'South Korea' },
{ id: 2, name: 'Emma Stone', country: '' },
{ id: 3, name: 'Noah Kim', country: 'Japan' },
];
// On a narrow screen (520px or less) or a low touch screen the list opens as a sheet sliding up from the bottom.
// Items are at least 44px, and pressing the dark backdrop closes only the list. On desktop it is a popup below the cell.
const options = {
columns: [
{ id: 'name', title: 'Name', width: 130 },
{
id: 'country',
title: 'Country',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: 'Search country', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
function setup(api, log) {
log('Narrow the window or use a phone and double-click a "Country" cell. The list opens as a bottom sheet.');
const offs = [
api.on('editCommitted', (e) => log(`Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`)),
];
return () => offs.forEach((off) => off());
}
options.ariaLabel = "A bottom sheet on narrow screens";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
setup(api, (message) => {
const item = document.createElement('li');
item.textContent =
typeof message === 'string' ? message : navigator.language.startsWith('ko') ? message.ko : message.en;
document.getElementById('log').prepend(item);
});
</script>
</body>
</html>When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { useEffect } from 'react';
import { Grid, useGridApi } from '@maxgrid/react';
import { options, setup, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
useEffect(() => (api ? setup(api, console.log) : undefined), [api]);
return (
<>
<Grid style={{ height: 260 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'South Korea',
'Japan',
'China',
'United States',
'Canada',
'Mexico',
'Brazil',
'United Kingdom',
'France',
'Germany',
'Italy',
'Spain',
'India',
'Australia',
'New Zealand',
'Vietnam',
'Thailand',
'Singapore',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: 'Liam Carter', country: 'South Korea' },
{ id: 2, name: 'Emma Stone', country: '' },
{ id: 3, name: 'Noah Kim', country: 'Japan' },
];
// On a narrow screen (520px or less) or a low touch screen the list opens as a sheet sliding up from the bottom.
// Items are at least 44px, and pressing the dark backdrop closes only the list. On desktop it is a popup below the cell.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 130 },
{
id: 'country',
title: 'Country',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: 'Search country', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log(
'Narrow the window or use a phone and double-click a "Country" cell. The list opens as a bottom sheet.',
);
const offs = [
api.on('editCommitted', (e) => log(`Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`)),
];
return () => offs.forEach((off) => off());
}When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<script setup lang="ts">
import { onBeforeUnmount, shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { options, setup, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
let stop: (() => void) | undefined;
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
stop = setup(event.api, console.log);
}
onBeforeUnmount(() => stop?.());
</script>
<template>
<Grid style="height: 260px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'South Korea',
'Japan',
'China',
'United States',
'Canada',
'Mexico',
'Brazil',
'United Kingdom',
'France',
'Germany',
'Italy',
'Spain',
'India',
'Australia',
'New Zealand',
'Vietnam',
'Thailand',
'Singapore',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: 'Liam Carter', country: 'South Korea' },
{ id: 2, name: 'Emma Stone', country: '' },
{ id: 3, name: 'Noah Kim', country: 'Japan' },
];
// On a narrow screen (520px or less) or a low touch screen the list opens as a sheet sliding up from the bottom.
// Items are at least 44px, and pressing the dark backdrop closes only the list. On desktop it is a popup below the cell.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 130 },
{
id: 'country',
title: 'Country',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: 'Search country', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log(
'Narrow the window or use a phone and double-click a "Country" cell. The list opens as a bottom sheet.',
);
const offs = [
api.on('editCommitted', (e) => log(`Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`)),
];
return () => offs.forEach((off) => off());
}When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Component, OnDestroy } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { options, setup, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<mx-grid style="height: 260px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent implements OnDestroy {
readonly options = options;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
private stop: (() => void) | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
this.stop = setup(this.api, console.log);
}
}
ngOnDestroy(): void {
this.stop?.();
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export type LogText = string | { ko: string; en: string };
export interface Row {
id: number;
name: string;
country: string;
}
const COUNTRIES = [
'South Korea',
'Japan',
'China',
'United States',
'Canada',
'Mexico',
'Brazil',
'United Kingdom',
'France',
'Germany',
'Italy',
'Spain',
'India',
'Australia',
'New Zealand',
'Vietnam',
'Thailand',
'Singapore',
].map((value) => ({ value }));
const rows: Row[] = [
{ id: 1, name: 'Liam Carter', country: 'South Korea' },
{ id: 2, name: 'Emma Stone', country: '' },
{ id: 3, name: 'Noah Kim', country: 'Japan' },
];
// On a narrow screen (520px or less) or a low touch screen the list opens as a sheet sliding up from the bottom.
// Items are at least 44px, and pressing the dark backdrop closes only the list. On desktop it is a popup below the cell.
export const options: GridOptions<Row> = {
columns: [
{ id: 'name', title: 'Name', width: 130 },
{
id: 'country',
title: 'Country',
width: 180,
editable: true,
cellEditor: 'combobox',
editorOptions: COUNTRIES,
editorParams: { placeholder: 'Search country', maxHeight: 280 },
},
],
rows,
rowKey: 'id',
};
export function setup(api: GridApi<Row>, log: (message: LogText) => void) {
log(
'Narrow the window or use a phone and double-click a "Country" cell. The list opens as a bottom sheet.',
);
const offs = [
api.on('editCommitted', (e) => log(`Row ${e.rowKey}: ${e.columnId} = ${String(e.newValue)}`)),
];
return () => offs.forEach((off) => off());
}