Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 5575132

Browse files
Merge pull request #285 from chakra-ui/fix/icon-button-type-attr
fix/icon button type attr
2 parents 800f0be + e436421 commit 5575132

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

.changeset/tasty-grapes-rhyme.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
"@chakra-ui/c-visually-hidden": patch
3+
"@chakra-ui/c-theme-provider": patch
4+
"@chakra-ui/vue-composables": patch
5+
"@chakra-ui/c-close-button": patch
6+
"@chakra-ui/c-form-control": patch
7+
"@chakra-ui/c-media-query": patch
8+
"@chakra-ui/c-scroll-lock": patch
9+
"@chakra-ui/c-breadcrumb": patch
10+
"@chakra-ui/c-color-mode": patch
11+
"@chakra-ui/c-focus-lock": patch
12+
"@chakra-ui/c-accordion": patch
13+
"@chakra-ui/c-pin-input": patch
14+
"@chakra-ui/c-checkbox": patch
15+
"@chakra-ui/c-skip-nav": patch
16+
"@chakra-ui/vue-test-utils": patch
17+
"@chakra-ui/c-popover": patch
18+
"@chakra-ui/c-spinner": patch
19+
"@chakra-ui/c-avatar": patch
20+
"@chakra-ui/c-button": patch
21+
"@chakra-ui/c-motion": patch
22+
"@chakra-ui/c-popper": patch
23+
"@chakra-ui/c-portal": patch
24+
"@chakra-ui/vue-accessibilty": patch
25+
"@chakra-ui/c-alert": patch
26+
"@chakra-ui/c-image": patch
27+
"@chakra-ui/c-input": patch
28+
"@chakra-ui/c-modal": patch
29+
"@chakra-ui/c-reset": patch
30+
"@chakra-ui/c-toast": patch
31+
"@chakra-ui/c-code": patch
32+
"@chakra-ui/c-icon": patch
33+
"@chakra-ui/c-menu": patch
34+
"@chakra-ui/vue-layout": patch
35+
"@chakra-ui/vue-styled": patch
36+
"@chakra-ui/vue-system": patch
37+
"@chakra-ui/c-tag": patch
38+
"@chakra-ui/vue-utils": patch
39+
"@chakra-ui/vue-next": patch
40+
---
41+
42+
Fix: Passthrough user-defined type attr for all button/iconbuttons

packages/c-button/src/button.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ import {
1414
ComponentWithProps,
1515
DeepPartial,
1616
} from "@chakra-ui/vue-system"
17-
import {
18-
ThemingProps,
19-
SystemStyleObject
20-
} from "@chakra-ui/styled-system"
17+
import { ThemingProps, SystemStyleObject } from "@chakra-ui/styled-system"
2118
import { dataAttr, filterUndefined, mergeWith } from "@chakra-ui/utils"
2219
import { useButtonGroup } from "./button-group"
2320
import { CIcon, IconProps } from "@chakra-ui/c-icon"
@@ -110,7 +107,7 @@ const CButtonIcon = defineComponent({
110107
},
111108
})
112109

113-
export interface CButtonProps extends HTMLChakraProps<"button"> { }
110+
export interface CButtonProps extends HTMLChakraProps<"button"> {}
114111

115112
/**
116113
* CButton
@@ -205,7 +202,8 @@ export const CButton = defineComponent({
205202
{...((props.value.isDisabled || props.value.isLoading) && {
206203
disabled: props.value.isDisabled || props.value.isLoading,
207204
})}
208-
type={props.value.as === "button" ? undefined : props.value.type}
205+
type={props.value.type}
206+
data-type={dataAttr(props.value.type)}
209207
data-active={dataAttr(props.value.isActive)}
210208
data-loading={dataAttr(props.value.isLoading)}
211209
__css={buttonStyles.value}

0 commit comments

Comments
 (0)