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

@atlaskit/button

원문 보기 위키 갱신

버튼(Button)은 이벤트나 액션을 트리거하는 상호작용형 컴포넌트로, 사용자가 다음에 어떤 일이 일어날지 알 수 있게 해 줘요.

출처: 문서

본문

ButtonGroup 컴포넌트

관련 버튼들을 일관된 간격과 정렬로 묶어주는 컴포넌트예요.

  • Keywords: button, group, container, layout, spacing
  • Categories: form
  • Status: general-availability

예시

import ButtonGroup from '@atlaskit/button/button-group';
import Button from '@atlaskit/button/default/button';
const _default_1: React.JSX.Element[] = [
	<ButtonGroup titleId="heading-options">
		<Button appearance="primary">Save</Button>
		<Button appearance="danger">Delete</Button>
		<Button appearance="subtle">Cancel</Button>
	</ButtonGroup>,
];
export default _default_1;

Props

Prop Type Description
children string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal The buttons to render inside the button group
label string Refers to an aria-label attribute
titleId string ID referenced by the button group wrapper's aria-labelledby attribute

사용 지침

  • 함께 사용하는 관련 액션에 사용해요.
  • 비슷하거나 보완적인 액션을 수행하는 버튼을 묶어요.
  • 일관된 간격과 정렬을 유지해요.
  • 그룹 안의 시각적 위계를 고려해요.
  • 서로 관련 없는 액션은 묶지 마요.
  • 시각적으로 묶어야 하는 여러 관련 액션이 있을 때 사용해요.
  • 버튼 사이의 일관된 간격과 정렬을 제공해요.

콘텐츠 지침

  • 버튼 라벨의 어조와 스타일을 일관되게 유지해요.
  • 관련 액션에는 병렬 구조를 사용해요.
  • 라벨을 간결하지만 설명적으로 유지해요.
  • 그룹 안에서 액션의 순서를 고려해요.

Button 컴포넌트

여러 appearance(모양)와 상태를 갖추고 액션을 트리거하는 다용도 버튼 컴포넌트예요. 버튼은 이벤트나 액션을 트리거해요. 사용자에게 다음에 무슨 일이 일어날지 알려줘요.

  • Keywords: button, action, click, submit, form, interactive, cta
  • Categories: form
  • Status: general-availability

예시

import Button from '@atlaskit/button/default/button';
export default function ButtonDisabledExample(): React.JSX.Element {
	return (
		<Button appearance="primary" isDisabled>
			Disabled button
		</Button>
	);
}

예시

import Button from '@atlaskit/button/default/button';
export default function ButtonDangerExample(): React.JSX.Element {
	return <Button appearance="danger">Danger button</Button>;
}

예시

import Button from '@atlaskit/button/default/button';
import StarIcon from '@atlaskit/icon/core/star-starred';
export default function ButtonIconAfterExample(): React.JSX.Element {
	return (
		<Button iconAfter={StarIcon} appearance="primary">
			Icon after
		</Button>
	);
}

Props

Prop Type Description
appearance "warning" | "default" | "primary" | "discovery" | "danger" | "rovo" | "subtle" The button style variation
autoFocus boolean Set the button to autofocus on mount
children string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal Text content to be rendered in the button (required)
iconAfter ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button, after the button's text
iconBefore ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button, before the button's text
isDisabled boolean Disable the button to prevent user interaction
isLoading boolean Conditionally show a spinner over the top of a button
isSelected boolean Indicates that the button is selected
onBlur (event: FocusEvent<HTMLButtonElement, Element>) => void Handler called on blur
onClick (e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void Handler called on click
onFocus (event: FocusEvent<HTMLButtonElement, Element>) => void Handler called on focus
shouldFitContainer boolean Option to fit button width to its parent width
spacing "default" | "compact" Controls the amount of padding in the button

사용 지침

  • 페이지의 주요 액션에는 primary 버튼을 사용해요.
  • 한 섹션에 primary 버튼 하나로 제한해요.
  • 좁은 공간에는 compact 크기를 사용해요.
  • 보조 액션에는 subtle 버튼을 사용해요.
  • 파괴적인 액션에는 danger 버튼을 신중하게 사용해요.
  • 관련 버튼은 ButtonGroup으로 묶어요.
  • 액션에는 버튼을, 내비게이션에는 링크를 사용해요(의미론과 보조 기술 동작이 달라요).

콘텐츠 지침

  • 상호작용을 설명하는 동작 동사를 사용해요.
  • 텍스트를 간결하게 유지해요(이상적으로 1~3단어).
  • "Submit"이나 "Click here" 같은 일반적인 표현은 피해요.
  • 문장형 대소문자(sentence case)를 사용해요.
  • 버튼 라벨을 주변 UI와 일관되게 유지해요(예: 모달의 primary 버튼은 모달의 의도를 반영해야 해요).
  • 액션에는 버튼을, 내비게이션에는 링크를 사용해요.
  • 영역마다 primary 콜투액션(CTA)은 하나만 포함해요.
  • 동사로 시작하고 대상이 무엇인지 구체적으로 밝혀요.
  • 버튼 라벨에 문장 부호를 사용하지 마요.

접근성 지침

  • 스크린 리더에 항상 의미 있는 라벨을 제공해요.
  • 비동기 액션에 대해 로딩 상태 안내를 제공해요.

IconButton 컴포넌트

아이콘 하나만 표시하고 선택적으로 툴팁을 갖는 버튼이에요. 툴바 액션, 컴팩트한 인터페이스, 공간이 제한된 곳에 딱 좋아요.

  • Keywords: button, icon, action, click, interactive, toolbar
  • Categories: form
  • Status: general-availability

예시

import IconButton from '@atlaskit/button/icon/button';
import AddIcon from '@atlaskit/icon/core/add';
import DeleteIcon from '@atlaskit/icon/core/delete';
import InfoIcon from '@atlaskit/icon/core/status-information';
const _default_1: React.JSX.Element[] = [
	<IconButton icon={AddIcon} label="Add new item" appearance="primary" />,
	<IconButton icon={InfoIcon} label="Show information" appearance="subtle" spacing="compact" />,
	<IconButton icon={DeleteIcon} label="Delete permanently" appearance="discovery" shape="circle" />,
];
export default _default_1;

Props

Prop Type Description
appearance "default" | "primary" | "discovery" | "rovo" | "subtle" The button style variation
autoFocus boolean Set the button to autofocus on mount
icon ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button (required)
isDisabled boolean Disable the button to prevent user interaction
isLoading boolean Conditionally show a spinner over the top of a button
isSelected boolean Indicates that the button is selected
isTooltipDisabled boolean Prevents a tooltip with the label text from showing
label string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal Provide an accessible label, often used by screen readers (required)
onBlur (event: FocusEvent<HTMLButtonElement, Element>) => void Handler called on blur
onClick (e: MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void Handler called on click
onFocus (event: FocusEvent<HTMLButtonElement, Element>) => void Handler called on focus
shape "circle" | "default" Set the shape of the icon, defaults to square with rounded corners
spacing "default" | "compact" Controls the amount of padding in the button
tooltip { testId?: string; analyticsContext?: Record<string, any>; content?: ReactNode | (({ update }: { update?: () => void; }) => ReactNode); component?: ComponentType<TooltipPrimitiveProps> | ForwardRefExoticComponent<...>; ... 15 more ...; shouldRenderToParent?: boolean; } Props passed down to the Tooltip component

사용 지침

  • 툴바 액션과 컴팩트한 인터페이스에 사용해요.
  • 기능을 명확하게 나타내는 아이콘을 골라요.
  • 관련 있는 아이콘 버튼을 함께 묶어요.
  • 시각적 혼란을 피하기 위해 절제해서 사용해요.
  • 추가 맥락을 위해 툴팁 사용을 고려해요.
  • 접근성을 위해 항상 의미 있는 라벨을 제공해요.
  • 아이콘은 수행하는 액션을 명확히 나타내야 해요.

콘텐츠 지침

  • 명확하고 간결하며 설명적인 라벨을 사용해요.
  • 동작 동사를 사용해요(예: "Edit item", "Delete comment").
  • 보편적으로 이해되는 아이콘을 선택해요.
  • 중요한 액션에 라벨 없는 아이콘을 사용하지 마요.

LinkIconButton 컴포넌트

사용자가 공통 링크나 페이지 위치로 이동하도록 돕는 아이콘 전용 버튼이에요.

  • Keywords: button, icon, link, navigation, href, anchor
  • Categories: form
  • Status: general-availability

예시

import LinkIconButton from '@atlaskit/button/icon/link';
import QuestionCircleIcon from '@atlaskit/icon/core/question-circle';
const LinkIconButtonDefaultExample = (): React.JSX.Element => {
	return (
		<LinkIconButton href="https://atlassian.com" icon={QuestionCircleIcon} label="View help" />
	);
};
export default LinkIconButtonDefaultExample;

Props

Prop Type Description
appearance "default" | "primary" | "discovery" | "rovo" | "subtle" The button style variation
autoFocus boolean Set the button to autofocus on mount
href string | RouterLinkConfig Provides a URL for link buttons (required)
icon React.ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | React.FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button (required)
isDisabled boolean Disable the button to prevent user interaction
isSelected boolean Indicates that the button is selected
isTooltipDisabled boolean Prevents a tooltip with the label text from showing
label string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal Provide an accessible label, often used by screen readers (required)
newWindowLabel string Override the default text used to announce that the link opens in a new window
onBlur (event: React.FocusEvent<HTMLAnchorElement, Element>) => void Handler called on blur
onClick ((e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void) & ((e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void) Handler called on click
onFocus (event: React.FocusEvent<HTMLAnchorElement, Element>) => void Handler called on focus
shape "circle" | "default" Set the shape of the icon, defaults to square with rounded corners
spacing "default" | "compact" Controls the amount of padding in the button
tooltip { testId?: string; analyticsContext?: Record<string, any>; content?: React.ReactNode | (({ update }: { update?: () => void; }) => React.ReactNode); component?: React.ComponentType<TooltipPrimitiveProps> | React.ForwardRefExoticComponent<...>; ... 15 more ...; shouldRenderToParent?: boolean; } Props passed down to the Tooltip component

사용 지침

  • 페이지 URL이나 위치를 바꾸는 내비게이션이나 기타 액션에 사용해요.
  • 명확하고 보편적으로 이해되는 의미를 지닌 기존 시스템 아이콘을 사용해요.
  • 아이콘만으로는 모호할 때 텍스트 라벨이 있는 링크 버튼을 사용해요.

콘텐츠 지침

  • 툴팁과 스크린 리더에 항상 명확하고 구체적인 라벨을 제공해요.
  • 라벨은 문장형 대소문자(sentence case)를 사용해요.
  • 가능하면 대상 객체를 명시해요. 예를 들어 "Edit" 대신 "Edit page"처럼요.

접근성 지침

  • 항상 의미 있는 라벨을 제공해요. 이 라벨은 보조 기술을 위해 시각적으로 숨겨진 콘텐츠로 렌더링돼요.
  • 가능하면 버튼 비활성화를 피해요.

LinkButton 컴포넌트

내비게이션을 위해 앵커 태그로 렌더링되는 버튼이에요. 버튼의 시각적 모양과 링크의 의미론적 동작을 결합해요.

  • Keywords: button, link, navigation, href, anchor
  • Categories: form
  • Status: general-availability

예시

import LinkButton from '@atlaskit/button/link';
const _default_1: React.JSX.Element[] = [
	<LinkButton href="https://atlassian.com" target="_blank" appearance="subtle">
		External Link
	</LinkButton>,
	// With a Router (requires `<AppProvider routerLinkComponent={Link} />` setup at the root)
	<LinkButton href={{ to: '/about', replace: true }}>About Page</LinkButton>,
];
export default _default_1;

Props

Prop Type Description
appearance "warning" | "default" | "primary" | "discovery" | "danger" | "rovo" | "subtle" The button style variation
autoFocus boolean Set the button to autofocus on mount
children string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal Text content to be rendered in the button (required)
href string | RouterLinkConfig Provides a URL for link buttons (required)
iconAfter React.ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | React.FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button, after the button's text
iconBefore React.ComponentClass<Omit<IconProps, "size"> | Omit<NewIconProps, "size" | "spacing">, any> | React.FunctionComponent<Omit<IconProps, "size"> | Omit<...>> Places an icon within the button, before the button's text
isDisabled boolean Disable the button to prevent user interaction
isSelected boolean Indicates that the button is selected
onBlur (event: React.FocusEvent<HTMLAnchorElement, Element>) => void Handler called on blur
onClick (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void Handler called on click
onFocus (event: React.FocusEvent<HTMLAnchorElement, Element>) => void Handler called on focus
shouldFitContainer boolean Option to fit button width to its parent width
spacing "default" | "compact" Controls the amount of padding in the button

사용 지침

  • URL을 바꾸는 내비게이션 액션에 사용해요.
  • 외부 링크와 내부 내비게이션에 사용해요.
  • 내비게이션하지 않는 액션에는 일반 버튼을 사용하는 것을 고려해요.
  • 링크 동작에 대한 명확한 시각적 표시를 제공해요.
  • 적절할 때 다른 버튼과 일관된 스타일을 사용해요.
  • 버튼처럼 보이지만 링크처럼 동작해야 하는 내비게이션 액션에 사용해요.
  • 외부 링크, 내부 내비게이션, 또는 URL을 바꾸는 모든 액션에 완벽해요.

콘텐츠 지침

  • 목적지를 나타내는 명확하고 설명적인 텍스트를 사용해요.
  • 링크가 사용자를 어디로 데려갈지 구체적으로 밝혀요.
  • 적절할 때 액션 지향적인 언어를 사용해요.
  • 'Click here'나 'Learn more' 같은 일반적인 표현은 피해요.

SplitButton 컴포넌트

primary 액션과 드롭다운 메뉴로 나뉘는 버튼이에요. 메인 버튼은 primary 액션을 수행하고, 드롭다운 화살표는 추가 관련 액션을 드러내요.

  • Keywords: button, split, dropdown, menu, action, options
  • Categories: form
  • Status: general-availability

예시

import Button from '@atlaskit/button/default/button';
import IconButton from '@atlaskit/button/icon/button';
import { SplitButton } from '@atlaskit/button/split-button/split-button';
import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
import DropdownItemGroup from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
const _default_1: React.JSX.Element = (
	<SplitButton spacing="compact">
		<Button>Link work item</Button>
		<DropdownMenu
			shouldRenderToParent
			trigger={({ triggerRef, ...triggerProps }) => (
				<IconButton
					ref={triggerRef}
					{...triggerProps}
					icon={ChevronDownIcon}
					label="More link work item options"
				/>
			)}
		>
			<DropdownItemGroup>
				<DropdownItem>Create new link</DropdownItem>
				<DropdownItem>Link existing item</DropdownItem>
			</DropdownItemGroup>
		</DropdownMenu>
	</SplitButton>
);
export default _default_1;

Props

Prop Type Description
appearance "default" | "primary" The style variation for child buttons
children string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal Only two children are allowed (required)
isDisabled boolean Whether all child buttons should be disabled
spacing "default" | "compact" Controls the amount of padding in the child buttons

사용 지침

  • 항상 정확히 두 개의 자식 요소(Button과 DropdownMenu)가 서로 관련되어 있어야 해요.
  • 올바른 위치 지정을 위해 DropdownMenu에 shouldRenderToParent를 사용해요.
  • primary 액션을 가장 흔하거나 중요한 액션으로 만들어요.
  • 사용자를 압도하지 않도록 드롭다운 항목을 제한해요.

콘텐츠 지침

  • primary 버튼에는 명확하고 액션 지향적인 텍스트를 사용해요.
  • 드롭다운 항목 라벨을 간결하고 설명적으로 유지해요.
  • 관련 액션 사이에 일관된 용어를 사용해요.

접근성 지침

  • IconButton 트리거에 설명적인 라벨을 제공해요.

더 알아보기 (Learn more)