본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

날짜 라벨

원문 보기 위키 갱신

날짜 라벨 (Date Label)

날짜 라벨은 날짜를 라벨로 표시해주는 컴포넌트예요. 마감일이나 기한이 지난 날짜 같은 의미 있는 상태를 전달하기 위해 선택적으로 appearance를 지정할 수 있어요.

출처: 문서

본문

DateLabel 컴포넌트

날짜 라벨은 날짜를 라벨로 표시하고, 선택적으로 appearance를 지정해 마감일이나 기한이 지난 날짜 같은 의미 있는 조건을 전달해요.

  • Keywords: date, label, date label, due date, overdue, lozenge
  • Categories: status-indicators
  • Status: open-beta

예시

/**
 * @jsxRuntime classic
 * @jsx jsx
 */
import { cssMap, jsx } from '@atlaskit/css';
import DateLabel from '@atlaskit/date-label/date-label';
import { token } from '@atlaskit/tokens';
const styles = cssMap({
	wrapper: {
		display: 'flex',
		gap: token('space.100'),
		flexWrap: 'wrap',
	},
});
/**
 * Basic example showing all three appearances of DateLabel with icons (default).
 */
export default function Basic(): React.JSX.Element {
	return (
		<div css={styles.wrapper}>
			<DateLabel label="29 Jul 2026" appearance="neutral" testId="date-label" />
			<DateLabel label="29 Jul 2026" appearance="warning" />
			<DateLabel label="29 Jul 2026" appearance="danger" />
		</div>
	);
}

Props

Prop Type Description
appearance "warning" | "danger" | "neutral" Controls the visual style of the date label
hasIconBefore boolean When true, an icon is displayed before the label text
iconLabel string The accessible label for the icon
isSpacious boolean When true, increases the padding and height of the date label for use in more spacious layouts (e
label string The text content to display inside the date label (required)
maxWidth string | number The maximum width of the date label

사용 지침

  • 객체에 날짜를 라벨로 표시할 때 사용해요(예: 마감일), 날짜를 입력하거나 선택하는 용도는 아니에요.
  • appearance를 사용해 의미 있는 조건을 전달해요: 기본은 neutral, 다가오는 날짜는 warning, 기한이 지났거나 중요한 날짜는 danger예요.
  • 기본적으로 앞에 아이콘이 표시되며 appearance에 따라 달라져요(calendar, warning, danger). 숨기려면 hasIconBefore={false}로 설정해요.
  • 날짜 라벨을 버튼 옆에 표시할 때는 넓은 사이즈(spacious sizing)를 사용해요.
  • 폼에서 날짜를 입력하거나 선택할 때는 @atlaskit/datetime-picker의 DatePicker를 대신 사용해요.
  • 사용자가 드롭다운으로 날짜를 바꾸기 위해 날짜 라벨을 클릭해야 한다면, 대화형 날짜 전환용으로 만들어진 DateLabelDropdownTrigger를 사용해요.

콘텐츠 지침

  • 날짜 형식을 간결하게 유지하고 주변 경험과 일관되게 해요.
  • appearance를 조건을 명확히 하는 라벨과 함께 사용해요; 색상만으로 의존하지 마세요.
  • 라벨마다 날짜 값 하나를 사용해요.

접근성 지침

  • 날짜 조건을 전달할 때 색상만으로 의존하지 마세요; 날짜 텍스트가 그 자체로 의미가 있도록 해요.
  • 모든 appearance에서 날짜 텍스트의 색 대비가 충분한지 보장해요.
  • 스크린 리더에 명확하고 설명적인 텍스트를 제공해요.

DateLabelDropdownTrigger 컴포넌트

날짜 라벨 드롭다운 트리거는 날짜를 라벨로 표시하면서 메뉴나 팝업을 통해 날짜를 바꿀 수 있게 해줘요.

  • Keywords: date, label, dropdown, trigger, date label, menu, interactive
  • Categories: status-indicators
  • Status: open-beta

예시

/**
 * @jsxRuntime classic
 * @jsx jsx
 */
import { cssMap, jsx } from '@atlaskit/css';
import DateLabelDropdownTrigger from '@atlaskit/date-label/date-label-dropdown-trigger';
import { Text } from '@atlaskit/primitives/compiled/text';
import { token } from '@atlaskit/tokens';
const styles = cssMap({
	column: {
		display: 'flex',
		flexDirection: 'column',
		gap: token('space.200'),
	},
	row: {
		display: 'flex',
		gap: token('space.100'),
		flexWrap: 'wrap',
		alignItems: 'center',
	},
});
/**
 * DateLabelDropdownTrigger — an interactive date label that acts as a dropdown trigger.
 * Renders as a button with hover, pressed, and focus ring states, plus a chevron icon.
 */
export default function DropdownTrigger(): React.JSX.Element {
	return (
		<div css={styles.column}>
			<div css={styles.row}>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="neutral"
					testId="date-label-dropdown-neutral"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="warning"
					testId="date-label-dropdown-warning"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="danger"
					testId="date-label-dropdown-danger"
				/>
			</div>
			<div css={styles.row}>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="neutral"
					isSpacious
					testId="date-label-dropdown-neutral-spacious"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="warning"
					isSpacious
					testId="date-label-dropdown-warning-spacious"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="danger"
					isSpacious
					testId="date-label-dropdown-danger-spacious"
				/>
			</div>
			<div css={styles.row}>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="neutral"
					hasIconBefore={false}
					testId="date-label-dropdown-no-icon"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="neutral"
					hasIconBefore={false}
					isSpacious
					testId="date-label-dropdown-no-icon-spacious"
				/>
			</div>
			<div css={styles.row}>
				<Text>Selected:</Text>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="neutral"
					isSelected
					testId="date-label-dropdown-neutral-selected"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="warning"
					isSelected
					testId="date-label-dropdown-warning-selected"
				/>
				<DateLabelDropdownTrigger
					label="29 Jul 2026"
					appearance="danger"
					isSelected
					testId="date-label-dropdown-danger-selected"
				/>
			</div>
		</div>
	);
}

Props

Prop Type Description
appearance "warning" | "danger" | "neutral" Controls the visual style of the trigger
aria-controls string Identifies the popup element that this trigger controls
aria-expanded boolean Announces to assistive technology whether the popup is currently open
aria-haspopup boolean | "dialog" Informs assistive technology that this element triggers a popup
aria-label string Defines a string value that labels the trigger element for assistive technology
hasIconBefore boolean When true, an icon is displayed before the label text
iconLabel string The accessible label for the leading icon
isLoading boolean When true, a spinner replaces the chevron icon and the trigger becomes non-interactive, indicating that an async operation is in progress (for example, saving a date selection)
isSelected boolean When true, renders the trigger in a selected/active state using the pressed background colour for the current appearance
isSpacious boolean When true, increases the padding and height of the trigger to 32px and uses the body font size for more spacious layouts
label string The text content to display inside the trigger (e (required)
maxWidth string | number The maximum width of the trigger
onClick (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void Callback fired when the trigger button is clicked

사용 지침

  • 날짜 선택을 가능하게 하려는 경우에 사용해요—날짜를 바꾸기 위한 드롭다운이나 팝업을 열 때만 사용해요.
  • 버튼 옆에 표시할 때는 넓은 사이즈(spacious sizing)를 사용해요.
  • 날짜에 대한 다른 정보를 전달하는 데는 사용하지 마세요; 비상호작용형 날짜 표시에는 DateLabel을 사용해요.
  • 폼에서 날짜를 입력하는 용도로 사용하지 마세요; @atlaskit/datetime-picker의 DatePicker를 대신 사용해요.

콘텐츠 지침

  • 날짜 형식을 간결하게 유지하고 주변 경험과 일관되게 해요.
  • 색상만으로 의존하지 마세요; appearance를 명확한 날짜 텍스트와 함께 사용해요.

접근성 지침

  • 날짜 조건을 전달할 때 색상만으로 의존하지 마세요; 날짜 텍스트가 그 자체로 의미가 있도록 해요.
  • 트리거가 키보드로 조작 가능하고 접근 가능한 이름(accessible name)을 노출하도록 해요.

더 알아보기 (Learn more)