Chakra UIでカスタムコンポーネントを作ろうとした時、いくつかやり方があることがわかってきた。 1. 別コンポーネントとして普通にラッパーを作る 一番驚きの少ない方法 const RoundedOutlineButton: FC<ButtonProps> = (props) => { return <Button variant="outline" borderStyle="solid" borderWidth="2px" rounded="full" px={10} py={5} letterSpacing="0.1em" {...props} /> }
![Chakra UIの再利用コンポーネント拡張の方法あれこれ](https://cdn-ak-scissors.b.st-hatena.com/image/square/a2e833559cfb3da3826308c0d5fa34d819f15d42/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--z3B4RYzG--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3AChakra%252520UI%2525E3%252581%2525AE%2525E5%252586%25258D%2525E5%252588%2525A9%2525E7%252594%2525A8%2525E3%252582%2525B3%2525E3%252583%2525B3%2525E3%252583%25259D%2525E3%252583%2525BC%2525E3%252583%25258D%2525E3%252583%2525B3%2525E3%252583%252588%2525E6%25258B%2525A1%2525E5%2525BC%2525B5%2525E3%252581%2525AE%2525E6%252596%2525B9%2525E6%2525B3%252595%2525E3%252581%252582%2525E3%252582%25258C%2525E3%252581%252593%2525E3%252582%25258C%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Aterrierscript%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL3plbm4tdXNlci11cGxvYWQvYXZhdGFyL2RhNzJjMjE0Y2QuanBlZw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)