대시보드
들어오자마자 보는 첫 화면이에요. 숫자로 지금 상태를, 목록으로 처리할 일을, 파일 카드로 최근 문서를 보여 줘요.
언제 써요
서비스의 홈처럼 여러 화면의 요약을 한곳에 모아, 어디로 갈지 고르게 할 때 써요.
화면 구조
위에서 아래 순서예요. 틀은 화면 틀 2 · 왼쪽 메뉴형이에요(GNB 의 화면 틀).
- 화면 제목홈과 한 줄 설명. 오른쪽에 가장 자주 하는 일 하나(새 문서)
- 숫자 카드지금 상태를 숫자 하나로. 라벨 · 숫자 · 한 줄 보조(지난달보다 · 진행 막대)
- 처리할 일결재 대기처럼 눌러서 들어가는 목록 카드, 옆에 공지와 할 일
- 최근 문서구역 제목과 전체 보기, 아래에 파일 카드 한 줄
쓰는 컴포넌트
App ShellGNBLNBPage HeaderCardList RowStatus BadgeCheckboxProgress BarContext MenuButton
Guidelines
✓ DO
- 카드마다 다른 화면으로 가는 길(전체 보기 · 행 화살표)을 둬요
- 숫자 카드는 숫자 하나와 한 줄 보조만 둬요
- 자주 하는 일 하나만 화면 제목 오른쪽에 둬요
✗ DON'T
- 카드 안에 표를 통째로 넣지 않아요(목록 몇 줄과 전체 보기)
- 숫자 카드를 다섯 개 넘게 늘어놓지 않아요
- 카드마다 색을 다르게 칠해 구분하지 않아요
좁은 화면에서
- 숫자 셋은 한 카드 안에 3칸으로 나란히 둬요
- 공지는 한 줄로 줄이고, 누르면 자세히 봐요
- 최근 문서는 가로로 넘겨 봐요
- 왼쪽 메뉴는 숨고 맨 위 햄버거로 열어요
쓰는 법
내 프로젝트에 PDS를 설치했다면
컴포넌트처럼 가져와 써요. AI에게 “PDS 대시보드 템플릿으로”라고 해도 돼요.
import { DashboardTemplate } from '@polarisoffice/pds-react';PDS가 없는 AI에게 원본 코드를 통째로 주려면
Template code
파일 하나예요. 위 미리보기가 이 코드를 그대로 그려요. 견본 데이터(상수)를 앱 데이터로 바꿔 쓰세요.
'use client';
import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from 'react';
import { createPortal } from 'react-dom';
import {
AppShell,
Button,
CalendarIcon,
Card,
Checkbox,
DashboardTemplate,
DownloadIcon,
Gnb,
IconButton,
ListRow,
Lnb,
Menu,
MenuDivider,
MenuItem,
MoreIcon,
SearchIcon,
Stack,
StatusBadge,
UserIcon,
} from '@polarisoffice/pds-react';
/**
* 템플릿 · 대시보드
* 들어오자마자 보는 첫 화면 — 숫자 카드로 지금 상태를, 목록 카드로 처리할 일을, 파일 카드로 최근 문서를 보여 준다.
* 화면 틀 2(GNB + 왼쪽 LNB). 데이터는 지어낸 견본이다. 실제 앱에서는 각 카드를 서버 응답으로 채운다.
*/
type Kind = 'doc' | 'sheet' | 'slide' | 'pdf';
const FORMAT: Record<Kind, { label: string; color: string }> = {
doc: { label: 'DOCX', color: 'var(--color-format-word)' },
sheet: { label: 'XLSX', color: 'var(--color-format-sheet)' },
slide: { label: 'PPTX', color: 'var(--color-format-slide)' },
pdf: { label: 'PDF', color: 'var(--color-format-pdf)' },
};
const APPROVALS = [
{ id: 'a1', title: '출장비 정산서', meta: '김하늘 · 오늘 09:12' },
{ id: 'a2', title: '11월 장비 구매 요청', meta: '박서준 · 어제' },
{ id: 'a3', title: '신규 입사자 계정 발급', meta: '이도윤 · 10월 27일' },
{ id: 'a4', title: '외부 강의 신청서', meta: '최유나 · 10월 25일' },
];
const RECENT: { id: string; name: string; kind: Kind; meta: string; isNew?: boolean }[] = [
{ id: 'r1', name: '하반기 사업 계획.pptx', kind: 'slide', meta: '김하늘 · 10분 전', isNew: true },
{ id: 'r2', name: '2분기 매출 정리.xlsx', kind: 'sheet', meta: '박서준 · 어제' },
{ id: 'r3', name: '서비스 이용 약관.docx', kind: 'doc', meta: '이도윤 · 3일 전' },
{ id: 'r4', name: '공급 계약서.pdf', kind: 'pdf', meta: '최유나 · 10월 21일' },
];
/** 메뉴 아이콘 — 패키지에 없는 모양만 여기서 그려요(18, 선 1.7) */
const Glyph = ({ d }: { d: string }) => (
<svg width={18} height={18} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.7} strokeLinecap="round" strokeLinejoin="round" aria-hidden>
<path d={d} />
</svg>
);
const FILE = 'M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7ZM14 2v4a2 2 0 0 0 2 2h4';
const ICON = {
filePlus: <Glyph d={`${FILE}M9 15h6M12 12v6`} />,
fileText: <Glyph d={`${FILE}M16 13H8M16 17H8M10 9H8`} />,
book: <Glyph d="M12 7v14M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" />,
open: <Glyph d="M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />,
rename: <Glyph d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4" />,
share: <Glyph d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8M16 6l-4-4-4 4M12 2v13" />,
trash: <Glyph d="M3 6h18M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2M10 11v6M14 11v6" />,
};
/**
* 버튼에 붙여 여는 메뉴. 카드는 모서리 때문에 넘치는 걸 잘라서 메뉴를 body 로 꺼내(portal) 버튼 끝에 맞춰요.
* 화면 아래쪽 버튼이면 위로 열고, 바깥을 누르거나 Esc · 스크롤이면 닫혀요.
*/
function MenuButton({
width,
trigger,
children,
}: {
width: number;
trigger: (props: { onClick: () => void; 'aria-expanded': boolean; 'aria-haspopup': 'menu' }) => ReactNode;
children: (close: () => void) => ReactNode;
}) {
const anchor = useRef<HTMLSpanElement>(null);
const panel = useRef<HTMLDivElement>(null);
const [pos, setPos] = useState<CSSProperties | null>(null);
const close = () => setPos(null);
useEffect(() => {
if (!pos) return;
const onDown = (e: MouseEvent) => {
const t = e.target as Node;
if (!panel.current?.contains(t) && !anchor.current?.contains(t)) close();
};
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && close();
document.addEventListener('mousedown', onDown);
document.addEventListener('keydown', onKey);
window.addEventListener('scroll', close, true);
window.addEventListener('resize', close);
return () => {
document.removeEventListener('mousedown', onDown);
document.removeEventListener('keydown', onKey);
window.removeEventListener('scroll', close, true);
window.removeEventListener('resize', close);
};
}, [pos]);
const toggle = () => {
if (pos) return close();
const r = anchor.current!.getBoundingClientRect();
const left = Math.max(8, r.right - width);
setPos(r.top > window.innerHeight / 2 ? { left, bottom: window.innerHeight - r.top + 4 } : { left, top: r.bottom + 4 });
};
return (
<span ref={anchor} style={{ display: 'inline-flex' }}>
{trigger({ onClick: toggle, 'aria-expanded': pos != null, 'aria-haspopup': 'menu' })}
{pos &&
createPortal(
<div ref={panel} style={{ position: 'fixed', zIndex: 100, ...pos }}>
<Menu width={width}>{children(close)}</Menu>
</div>,
document.body,
)}
</span>
);
}
/** 미리보기 자리 견본 — 실제 앱에서는 썸네일 이미지(<img>)를 넣어요 */
function Thumb({ kind }: { kind: Kind }) {
const f = FORMAT[kind];
const wide = kind === 'slide' || kind === 'sheet';
return (
<>
<span
style={{
display: 'flex',
flexDirection: 'column',
gap: 6,
boxSizing: 'border-box',
width: wide ? 168 : 88,
height: wide ? 100 : 116,
padding: 12,
borderRadius: 4,
borderTop: `6px solid ${f.color}`,
background: 'var(--color-background-base)',
boxShadow: 'var(--shadow-sm)',
}}
>
{['60%', '100%', '85%', '100%', '70%'].map((w, i) => (
<span key={i} style={{ width: w, height: 4, borderRadius: 2, background: 'var(--color-fill-strong)' }} />
))}
</span>
<span
style={{
position: 'absolute',
left: 12,
bottom: 12,
display: 'inline-flex',
alignItems: 'center',
gap: 6,
height: 24,
padding: '0 8px',
borderRadius: 6,
border: '1px solid var(--color-line-neutral)',
background: 'var(--color-background-base)',
fontSize: 12,
fontWeight: 700,
color: 'var(--color-label-neutral)',
}}
>
<span style={{ width: 8, height: 8, borderRadius: 2, background: f.color }} />
{f.label}
</span>
</>
);
}
/** 좁은 화면(767 이하, PageHeader · ActionBar 와 같은 지점) — 배치만 바꾼다 */
/** 숫자 카드 — 넓은 화면은 note, 좁은 화면 한 칸에는 short */
const STATS = [
{ label: '이번 달 만든 문서', value: '1,284', note: <>▲ 12% <span style={{ color: 'var(--color-label-assistive)' }}>지난달보다</span></>, short: '▲ 12%', good: true },
{ label: '결재 대기', value: '7건', note: '오늘 들어온 문서 3건', short: '오늘 3건' },
{ label: '저장 공간', value: '68%', progress: 68, note: '100GB 중 68GB 사용', short: '68GB 사용' },
];
export default function DashboardScreen() {
const [todos, setTodos] = useState([
{ id: 't1', label: '주간 보고 올리기', done: true },
{ id: 't2', label: '출장비 정산서 승인하기', done: false },
{ id: 't3', label: '3시 디자인 리뷰 자료 준비', done: false },
]);
const approvals = (
<Card title="결재 대기" isNew description="내가 승인할 문서가 4건 있어요" action={<Button variant="default" size={24}>전체 보기</Button>} flush>
{APPROVALS.map((a) => (
<ListRow key={a.id} title={a.title} description={a.meta} chevron href="#" />
))}
</Card>
);
const todoCard = (
<Card title="오늘 할 일">
<Stack gap="xs">
{todos.map((t) => (
<Checkbox
key={t.id}
checked={t.done}
onChange={(done) => setTodos((list) => list.map((x) => (x.id === t.id ? { ...x, done } : x)))}
label={t.done ? <span style={{ color: 'var(--color-label-assistive)', textDecoration: 'line-through' }}>{t.label}</span> : t.label}
/>
))}
</Stack>
</Card>
);
const recentCard = (d: (typeof RECENT)[number]) => ({
id: d.id,
media: <Thumb kind={d.kind} />,
isNew: d.isNew,
title: d.name,
description: d.meta,
action: (
<MenuButton width={176} trigger={(p) => <IconButton {...p} size={28} icon={<MoreIcon />} aria-label={`${d.name} 더보기`} />}>
{(close) => (
<>
<MenuItem icon={ICON.open} label="열기" onClick={close} />
<MenuItem icon={ICON.rename} label="이름 바꾸기" onClick={close} />
<MenuItem icon={ICON.share} label="공유" onClick={close} />
<MenuItem icon={<DownloadIcon size={16} />} label="내려받기" onClick={close} />
<MenuDivider />
<MenuItem icon={ICON.trash} label="삭제" onClick={close} />
</>
)}
</MenuButton>
),
});
return (
<AppShell
gnb={
<Gnb
brand={<span>문서함</span>}
actions={
<>
<IconButton size={32} aria-label="검색" icon={<SearchIcon />} />
<IconButton size={32} aria-label="내 정보" icon={<UserIcon />} />
</>
}
/>
}
lnb={
<Lnb
sections={[
{ label: '문서', items: [{ label: '홈', href: '#', active: true }, { label: '내 문서', href: '#' }, { label: '공유받은 문서', href: '#' }] },
{ label: '보관', items: [{ label: '즐겨찾기', href: '#' }, { label: '휴지통', href: '#' }, { label: '설정', href: '#' }] },
]}
/>
}
>
<DashboardTemplate
title="홈"
description="오늘 결재할 문서와 최근에 고친 문서를 모아 봤어요."
actions={
<MenuButton width={320} trigger={(p) => <Button {...p}>새 문서</Button>}>
{(close) => (
<>
<MenuItem icon={ICON.filePlus} label="빈 문서" description="아무것도 없는 문서에서 시작해요." onClick={close} />
<MenuItem icon={ICON.book} label="회의록" description="참석자, 안건, 결정한 것을 나눠 적어요." onClick={close} />
<MenuItem icon={<CalendarIcon size={16} />} label="주간 보고" description="지난주 한 일과 이번 주 할 일을 정리해요." onClick={close} />
<MenuItem icon={ICON.fileText} label="제안서" description="배경, 제안, 일정, 비용 순서로 써요." onClick={close} />
</>
)}
</MenuButton>
}
stats={STATS}
primary={approvals}
notice={{
badge: <StatusBadge tone="warning">예정</StatusBadge>,
title: '시스템 점검 안내',
description: '11월 2일(일) 새벽 2시부터 4시간 동안 문서 저장과 공유가 잠시 멈춰요. 그 전에 작업한 내용을 저장해 두세요.',
footer: (
<>
<span>운영팀 · 10월 28일</span>
<Button variant="default" size={32}>자세히 보기</Button>
</>
),
}}
secondary={todoCard}
recent={{
title: '최근 문서',
action: <Button variant="default" size={32}>전체 보기</Button>,
items: RECENT.map((d) => recentCard(d)),
}}
/>
</AppShell>
);
}
Specification
| 자리 | 값 |
|---|---|
| 본문 폭 | Container size="lg" (최대 1200) |
| 카드 줄 사이 | Stack gap="lg" (24) |
| 카드 사이 | grid auto-fit, 사이 16 (숫자 220 · 목록 360 · 파일 240 이상) |
| 숫자 | 28 · Bold, 라벨 · 보조는 13 label-alternative |
| 목록 카드 | Card flush + ListRow (카드가 시작선을 20 에 맞춤) |
| 구역 제목 | PageHeader level="section" as="h2" + Button default 32 |
Implementation Notes
- 숫자 카드는 Card 에 title 을 주지 않아 머리 없이 내용만 그려요
- 목록 카드는 flush 로 좌우 여백을 없애고, ListRow 글자를 제목과 같은 줄(20)에 맞춰요
- 공지의 상태는 Card badge 에 StatusBadge 로, 작성자와 버튼은 footer 에 둬요
- 파일 카드 더보기와 새 문서 메뉴는 문서 보관함과 같은 MenuButton 을 써요
- 767 이하에서는 useNarrow 로 배치만 바꿔요: 숫자 요약 한 카드(3칸) · 공지 한 줄 링크 · 최근 문서 가로 스크롤(카드 200, scroll-snap, 본문 여백까지 넘침)