logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Button

아래 코드로 버튼을 사용해보세요.
가져오기import{ Button }from"antd";
소스components/button
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

아래와 같을 때 사용합니다

버튼은 작업(또는 일련의 작업들)을 의미합니다. 버튼을 클릭하면 해당 비지니스 로직이 실행됩니다.

Ant Design에서는 5가지 유형의 버튼을 제공합니다.

  • 주 버튼(Primary button): 주요 작업에 사용되며, 한 섹션에 주 버튼은 최대 하나만 있을 수 있습니다.
  • 기본 버튼(Default button): 우선순위가 없는 일련의 작업에 사용됩니다.
  • 대시 버튼(Dashed button): 추가 작업을 위해 일반적으로 사용됩니다.
  • 텍스트 버튼(Text button): 가장 부차적인 작업에 사용됩니다.
  • 링크 버튼(Link button): 외부 링크에 사용됩니다.

추가적으로 4가지 속성이 더 있습니다:

  • danger: 삭제나 권한 부여와 같은 위험한 작업에 사용됩니다.
  • ghost: 복잡한 배경에서 사용되며, 주로 홈 화면에서 사용됩니다.
  • disabled: 액션을 허락되지 않을 때 사용됩니다.
  • loading: 버튼에 로딩 스피너를 추가하여 여러 번 제출하는 것을 방지합니다.

예시

API

공통 속성 참조:Common props

다양한 버튼 스타일은 버튼 속성을 설정함으로써 생성할 수 있습니다. 추천하는 순서는: type -> shape -> size -> loading -> disabled 입니다.

속성설명유형기본값버전
autoInsertSpace기본적으로 두 개의 글자 사이에 공백을 추가하지만, autoInsertSpace 를 false로 설정하면 이 공백을 제거할 수 있습니다.booleantrue5.17.0
block버튼 너비를 부모 요소의 너비에 맞추는 옵션booleanfalse
classNamesSemantic DOM 클래스Record<SemanticDOM, string>-5.4.0
danger버튼을 danger status로 설정합니다.booleanfalse
disabled버튼을 비활성화 합니다.booleanfalse
ghost배경을 투명하게 만들고 텍스트와 테두리 색상을 반전시킵니다.booleanfalse
href링크 버튼의 리디렉션 URL 설정string-
htmlTypebutton의 원래 HTML type 설정, 참고: MDNstringbutton
icon버튼의 아이콘 컴포넌트 설정ReactNode-
iconPosition버튼의 아이콘 위치 설정start | endstart5.17.0
loading버튼의 로딩 상태 설정boolean | { delay: number }false
shape버튼 모양을 설정할 수 있습니다.default | circle | rounddefault
size버튼의 사이즈 설정large | middle | smallmiddle
stylesSemantic DOM 스타일Record<SemanticDOM, CSSProperties>-5.4.0
target링크의 target 속성과 동일하며, href가 지정된 경우에 작동합니다.string-
type버튼 타입 설정primary | dashed | link | text | defaultdefault
onClickclick 이벤트를 처리할 핸들러를 설정합니다.(event: React.MouseEvent<HTMLElement, MouseEvent>) => void-

네이티브 버튼이 지원하는 모든 속성을 받아들입니다.

시맨틱(의미 있는) DOM

디자인 토큰

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
borderColorDisabled비활성화 상태 버튼의 테두리 색상string#d9d9d9
contentFontSize버튼 내용의 글꼴 크기number14
contentFontSizeLGlarge 버튼 내용의 글꼴 크기number16
contentFontSizeSMsmall 버튼 내용의 글꼴 크기number14
contentLineHeight버튼 내용의 줄 높이number1.5714285714285714
contentLineHeightLGlarge 버튼 내용의 줄 높이number1.5
contentLineHeightSMsmall 버튼 내용의 줄 높이number1.5714285714285714
dangerColordanger 버튼의 글씨 색상string#fff
dangerShadowdanger 버튼의 그림자string0 2px 0 rgba(255, 38, 5, 0.06)
defaultActiveBg활성 상태일 때 기본 버튼의 배경 색상string#ffffff
defaultActiveBorderColor활성 상태일 때 기본 버튼의 테두리 색상string#0958d9
defaultActiveColor활성 상태일 때 기본 버튼의 글자 색상string#0958d9
defaultBg기본 버튼의 배경 색상string#ffffff
defaultBorderColor기본 버튼의 테두리 색상string#d9d9d9
defaultColor기본 버튼의 글자 색상stringrgba(0, 0, 0, 0.88)
defaultGhostBorderColor기본적인 ghost 버튼의 테두리 색상string#ffffff
defaultGhostColor기본적인 ghost 버튼의 글자 색상string#ffffff
defaultHoverBg기본 버튼에 hover 했을 때 배경 색상string#ffffff
defaultHoverBorderColor기본 버튼에 hover 했을 때 테두리 색상string#4096ff
defaultHoverColor기본 버튼에 hover 했을 때 글자 색상string#4096ff
defaultShadow기본 버튼의 그림자string0 2px 0 rgba(0, 0, 0, 0.02)
fontWeight글꼴 굵기undefined | FontWeight400
ghostBg기본적인 ghost 버튼의 배경 색상stringtransparent
groupBorderColor버튼 그룹의 테두리 색상string#4096ff
linkHoverBg링크 버튼에 hover 했을 때 배경 색상stringtransparent
onlyIconSize아이콘만 포함된 버튼의 아이콘 크기number16
onlyIconSizeLG아이콘만 포함된 large 버튼의 아이콘 크기number18
onlyIconSizeSM아이콘만 포함된 small 버튼의 아이콘 크기number14
paddingBlock버튼의 수직 패딩undefined | PaddingBlock<string | number>4
paddingBlockLGlarge 버튼의 수직 패딩undefined | PaddingBlock<string | number>7
paddingBlockSMsmall 버튼의 수직 패딩undefined | PaddingBlock<string | number>0
paddingInline버튼의 수평 패딩undefined | PaddingInline<string | number>15
paddingInlineLGlarge 버튼의 수평 패딩undefined | PaddingInline<string | number>15
paddingInlineSMsmall 버튼의 수평 패딩undefined | PaddingInline<string | number>7
primaryColorprimary 버튼의 글자 색상string#fff
primaryShadowprimary 버튼의 그림자string0 2px 0 rgba(5, 145, 255, 0.1)
solidTextColorsolid 버튼의 기본 글자 색상string#fff
textHoverBg글씨 버튼에 hover 했을 때 배경 색상stringrgba(0, 0, 0, 0.06)
textTextActiveColor활성 상태의 텍스트 버튼 기본 텍스트 색상stringrgba(0, 0, 0, 0.88)
textTextColor글씨 버튼의 기본 글씨 색상stringrgba(0, 0, 0, 0.88)
textTextHoverColor글씨 버튼에 hover했을 때 기본 텍스트 색상stringrgba(0, 0, 0, 0.88)

글로벌 토큰어떻게 사용하나요?

자주 물어보는 질문

유형과 색상 및 변형을 어떻게 선택하나요?

유형(type)은 본질적으로 색상(color)과 변형(variant)에 대한 추가(syntactic sugar)된 문법입니다. 내부적으로 유형에 대해 색상과 변형 간의 매핑 관계를 설정합니다. 두 가지가 동시에 존재하는 경우, 색상과 변형이 우선적으로 사용됩니다.

<Button type="primary">click</Button>

아래와도 똑같습니다.

<Button color="primary" variant="solid">
click
</Button>

어떻게 클릭 파동 효과를 끌 수 있나요?

이 기능이 필요하지 않다면, ConfigProvider에서 wave의 disabled을 true로 설정할 수 있습니다.

<ConfigProvider wave={{ disabled: true }}>
<Button>click</Button>
</ConfigProvider>
Syntactic sugar
codepen icon
External Link Icon
expand codeexpand code
Debug Color & Variant
codepen icon
External Link Icon
expand codeexpand code
Icon Position
codepen icon
External Link Icon
expand codeexpand code
5.17.0
Debug Block
codepen icon
External Link Icon
expand codeexpand code
Disabled
codepen icon
External Link Icon
expand codeexpand code
Multiple Buttons
codepen icon
External Link Icon
expand codeexpand code
Danger Buttons
codepen icon
External Link Icon
expand codeexpand code
Deprecated Button Group
codepen icon
External Link Icon
expand codeexpand code
Component Token
codepen icon
External Link Icon
expand codeexpand code
Color & Variant
codepen icon
External Link Icon
expand codeexpand code
5.21.0
Icon
codepen icon
External Link Icon
expand codeexpand code
Debug Icon
codepen icon
External Link Icon
expand codeexpand code
Size
codepen icon
External Link Icon
expand codeexpand code
Loading
codepen icon
External Link Icon
expand codeexpand code
Ghost Button
codepen icon
External Link Icon
expand codeexpand code
Block Button
codepen icon
External Link Icon
expand codeexpand code
Loading style bug
codepen icon
External Link Icon
expand codeexpand code
Gradient Button
codepen icon
External Link Icon
expand codeexpand code
Preview
Href PrimaryHref Primary(disabled)


Preview
Preview
  • icon
    5.5.0
    아이콘 요소