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

Button

원문 보기 위키 갱신

클릭 같은 동작을 트리거할 때 쓰는 기본 컴포넌트예요. primary, secondary, tertiary, quaternary처럼 강조 강도별 스타일과 로딩·비활성화 상태를 갖추고 있어요. 화면 안에서 사용자가 무언가를 실행하는 지점이라면 거의 대부분 여기서 시작한다고 보면 돼요.

출처: 문서

본문

Button은 동작을 트리거할 때 사용해요.

Demos

basic.vue
secondary.vue
tertiary.vue
quaternary.vue
dashed.vue
size.vue
text.vue
tag.vue
disabled.vue
icon.vue
events.vue
shape.vue
ghost.vue
loading.vue
color.vue
group.vue
icon-button.vue
popover.vue

API

Button Props

이름 타입 기본값 설명 버전
attr-type 'button' | 'submit' | 'reset' 'button' 버튼 DOM의 type 속성.
block boolean false 버튼을 block으로 표시할지 여부.
bordered boolean true 버튼이 테두리를 보여줄지 여부.
circle boolean false 버튼을 원형으로 만들지 여부.
color string undefined 버튼 색 (#FFF, #FFFFFF, yellow,rgb(0, 0, 0) 형식의 색을 지원해요).
dashed boolean false 버튼의 테두리를 점선으로 표시할지 여부.
disabled boolean false 버튼을 비활성화할지 여부.
focusable boolean true 버튼이 포커스를 받을 수 있는지 여부.
ghost boolean false 버튼을 ghost 스타일로 표시할지 여부.
native-focus-behavior boolean 브라우저가 Safari가 아님 버튼의 네이티브 포커스 동작을 따를지 여부. Safari의 버튼은 클릭으로 포커스를 받을 수 없어서, naive-ui는 몇 가지 트릭으로 Safari에서도 포커스 가능하게 만들어요. 이 동작이 필요 없거나 버튼을 드래그 가능하게 만들어야 한다면 이 prop을 켜세요. 2.28.3
icon-placement 'left' | 'right' 'left' 버튼 안에서 아이콘의 위치.
keyboard boolean true 키보드 조작을 지원할지 여부.
quaternary boolean false 버튼이 quaternary 버튼인지 여부.
loading boolean false 버튼이 로딩 상태를 표시할지 여부.
spin-props { strokeWidth?: number, stroke?: string, scale?: number, radius?: number } undefined 로딩 아이콘 속성. 2.44.0
render-icon () => VNodeChild undefined 버튼 아이콘을 렌더링하는 함수. 2.34.0
round boolean false 버튼에 둥근 모서리를 적용할지 여부.
secondary boolean false 버튼이 secondary 버튼인지 여부.
size 'tiny' | 'small' | 'medium' | 'large' 'medium' 버튼 크기.
strong boolean false 버튼 안에서 강한(strong) 텍스트를 사용할지 여부.
tertiary boolean false 버튼이 tertiary 버튼인지 여부.
text boolean false 텍스트 버튼으로 표시할지 여부.
text-color string undefined 버튼 텍스트 색 (#FFF, #FFFFFF, yellow,rgb(0, 0, 0) 형식의 색을 지원해요).
type 'default' | 'tertiary' | 'primary' | 'success' | 'info' | 'warning' | 'error' 'default' 버튼 타입.
tag string 'button' 버튼을 어떤 태그로 렌더링할지.

ButtonGroup Props

이름 타입 기본값 설명
size 'tiny' | 'small' | 'medium' | 'large' undefined 버튼 그룹 안 버튼들의 크기. 설정하면 그룹 안 버튼의 size prop은 동작하지 않아요.
vertical boolean false 그룹 안 버튼들의 배치 방향.

Button Slots

이름 매개변수 설명
default () 버튼의 기본 콘텐츠.
icon () 버튼의 아이콘.

ButtonGroup Slots

이름 매개변수 설명
default () 버튼 그룹은 default로 채워져요.

더 알아보기 (Learn more)

버튼을 나란히 묶어 쓰는 방법은 위의 ButtonGroup Props를 참고하고, 아이콘 조합이나 로딩 상태는 각각 icon-button, loading 데모에서 확인할 수 있어요. 클릭 시 팝업을 띄우는 조합은 popover 데모와 Popover 문서를 보세요.