๐ป ๋๋ shadcn/ui๋ฅผ ๊ต์ฅํ ์ข์ํ๋ค. ํผ์ ๊ฐ๋ฐํ๋ค๋ฉด ๋ฌด์กฐ๊ฑด shadcn/ui๋ฅผ ์ฐ๊ณ ์ถ๋ค.
๐ป ์ด๋ฒ ํฌ์คํ ์์๋ shadcn ui์์ icon์ ์ฐ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ฃผ๊ณ ์ ํ๋ค.
๐ป ์ผ๋จ ๋จผ์ , Lucide-React icons๋ฅผ ์ฐ๋ ๊ฒฝ์ฐ
npm install lucide-react
๋ฉ์ผ ์์ด์ฝ๊ณผ Send Mail์ด๋ผ๋ ํ ์คํธ๊ฐ ์ ํ ๋ฒํผ์ ๋ง๋ค์ด๋ณด์.
import { Mail } from "lucide-react"
import { Button } from "@/components/ui/button"
export default function DemoIcon() {
return (
<Button>
<Mail className="mr-2 h-4 w-4" />
Send Mail
</Button>
)
}
๐ป heroicons(SVG) ์ฐ๋ ๊ฒฝ์ฐ
npm install @heroicons/react
์์ ๊ฐ์ ๋ฒํผ์ ์๋์ ์ฝ๋๋ก ๋ง๋ค ์ ์๋ค.
import { Button } from "@/components/ui/button"
export default function DemoIcon() {
return (
<Button>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
className="mr-1 w-4 h-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"
/>
</svg>
Send Mail
</Button>
)
}
svg๋ ์ด๋ ต๊ฒ ์๊ฐํ ๊ฒ ์์ด className์ผ๋ก ์ฌ์ด์ฆ ์ ์กฐ์ ํ๋ฉด ๋๋ค.
'๊ฐ๋ฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
TypeScript ์ ๋๋ฆญ (0) | 2024.07.11 |
---|---|
์ฟ ํค์ ์น ์คํ ๋ฆฌ์ง (0) | 2024.07.11 |
React Hook Form (1) | 2024.07.10 |
husky (0) | 2024.07.10 |
useRef (1) | 2024.07.10 |