admin管理员组文章数量:1123379
I want to style a mantine button via theming. But the inline style tag overwrites the theme and the custom hover color. How prevent mantine from using style tag? How to theme the button globally?
<button class="mantine-focus-auto mantine-active m_77c9d27d mantine-Button-root
m_87cf2631 mantine-UnstyledButton-root" data-variant="filled" data-size="sm"
type="button"
style="
--button-height: var(--button-height-sm);
--button-padding-x: var(--button-padding-x-sm);
--button-fz: var(--mantine-font-size-sm);
--button-radius: var(--mantine-radius-sm);
--button-bg: var(--mantine-color-blue-filled);
--button-hover: var(--mantine-color-blue-filled-hover);
> HELLO WORLD </button>
mantine-theme.ts
const theme: MantineThemeOverride = {
components: {
Button: {
styles: (theme: MantineTheme, params: { variant: string }) => ({
root: {
fontWeight: 300,
...(params.variant === "outline" && {
backgroundColor: "red",
"&:hover": {
backgroundColor: "green",
},
}),
},
}),
},
},
};
export default theme;
本文标签: reactjsHow to theme a mantine buttonStack Overflow
版权声明:本文标题:reactjs - How to theme a mantine button? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736562388a1944660.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论