डॉक्स / फ़्रेमवर्क
Astro
Astro साइट में UI Loft आइटम जोड़ें। Astro में पहले React और Tailwind जोड़ने पड़ते हैं, और हिलने वाले आइटम को क्लाइंट डायरेक्टिव चाहिए।
- वर्शन
- React
- ज़रूरत
- React + Tailwind 4 + shadcn
- सेटअप का समय
- करीब 5 मिनट
सेट करें
साइट बनाएँ
अगर आपके पास पहले से है तो इसे छोड़ दें।
टर्मिनलnpm create astro@latest my-site -- --template minimal --install --no-git --yes cd my-siteReact और Tailwind जोड़ें
Astro की अपनी कमांड दोनों इंस्टॉल करती है और
astro.config.mjsअपडेट करती है। यहsrc/styles/global.cssभी बनाती है।टर्मिनलnpx astro add react tailwind --yes@ alias जोड़ें
tsconfig.jsonमेंcompilerOptionsके नीचेpathsजोड़ें।tsconfig.json{ "compilerOptions": { "paths": { "@/*": ["./src/*"] } } }shadcn सेट करें
यह
components.jsonबनाता है औरsrc/styles/global.cssमें थीम भरता है।-dडिफ़ॉल्ट लेता है।टर्मिनलnpx shadcn@latest init -dआइटम जोड़ें
किसी भी आइटम पेज से कमांड कॉपी करें। फ़ाइल
src/components/में आती है।टर्मिनलnpx shadcn@latest add https://uiloft.dev/r/glow-button.jsonइस्तेमाल करें
स्टाइल और आइटम एक बार इम्पोर्ट करें, फिर आइटम को
client:loadदें ताकि वह ब्राउज़र में चले।src/pages/index.astro--- import "@/styles/global.css" import { GlowButton } from "@/components/glow-button" --- <html lang="en"> <body> <GlowButton client:load>Get started</GlowButton> </body> </html>
जानने लायक
- क्लाइंट डायरेक्टिव के बिना Astro आइटम को सादे HTML के रूप में भेजता है: वह दिखता है, पर हिलता या प्रतिक्रिया नहीं देता।
client:loadकी जगहclient:visibleआइटम के स्क्रॉल करके दिखने तक रुकता है।- लेआउट हो तो
@/styles/global.cssको हर पेज में नहीं, वहाँ एक बार इम्पोर्ट करें।