设计系统
减少编写 UI 代码的时间,而将更多的时间用于为客户打造出色的体验。
标记. 使用语义标记简化设计决策
排版. 在一个地方自定义字体相关属性
秘诀. 轻松设计组件变体
import { defineTokens } from "@chakra-ui/react"
export const tokens = defineTokens({
colors: {
primary: { value: "#0FEE0F" },
secondary: { value: "#EE0F0F" },
},
fonts: {
body: { value: "system-ui, sans-serif" },
},
animations: {
"slide-in-right": { value: "slide-in-right 0.5s ease-in-out" },
},
})
import { defineTextStyles } from "@chakra-ui/react"
export const textStyles = defineTextStyles({
headline: {
value: {
fontSize: "4xl",
fontWeight: "bold",
},
},
subheadline: {
value: {
fontSize: "2xl",
fontWeight: "semibold",
},
},
})
import { defineRecipe } from "@chakra-ui/react"
export const cardRecipe = defineRecipe({
base: {
display: "flex",
flexDirection: "column",
},
variants: {
variant: {
primary: {
bg: "teal.600",
color: "white",
},
},
},
})
Chakra 为大多数现代框架提供一致的开发人员体验