๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๊ฐœ๋ฐœ

Shadcn UI์™€ Icons

 

๐ŸŒป ๋‚˜๋Š” 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