타이포그래피
Tailwind v4 패키지는 Tailwind의 기본 font-sans 클래스(ui-sans-serif, system-ui, sans-serif, ...)를 사용합니다. CSS font-family는 상속되므로 fontFamily 스타일이 있는 컨테이너로 래핑하여 피커의 글꼴을 재정의할 수 있습니다. 래퍼의 글꼴은 모든 피커 요소에 계단식으로 적용됩니다.
폰트 패밀리
폰트를 전환하려면 피커를 래핑하고 래퍼에 fontFamily를 설정하세요:
import { useState } from "react";import { DatePicker } from "react-date-range-picker-tailwind4";
const fonts = { system: "inherit", serif: "'Georgia', 'Times New Roman', serif", mono: "'JetBrains Mono', 'Fira Code', monospace",};
type FontName = keyof typeof fonts;
function CompoundCustomFont() { const [value, setValue] = useState<Date | null>(null); const [font, setFont] = useState<FontName>("system");
return ( <div> <div style={{ display: "flex", gap: 8, marginBottom: 16 }}> {(Object.keys(fonts) as FontName[]).map((name) => ( <button key={name} onClick={() => setFont(name)} style={{ padding: "4px 12px", borderRadius: 4, border: `1px solid ${font === name ? "#3b82f6" : "#d1d5db"}`, background: font === name ? "#eff6ff" : "#fff", color: font === name ? "#3b82f6" : "#374151", cursor: "pointer", fontSize: 13, fontFamily: fonts[name], textTransform: "capitalize", }} > {name} </button> ))} </div> <div style={{ fontFamily: fonts[font] }}> <DatePicker value={value} onChange={setValue} inline /> </div> </div> );}March 2026
Su
Mo
Tu
We
Th
Fr
Sa
웹 폰트 사용 (Noto Sans)
런타임에 웹 폰트를 로드하고 래퍼를 통해 적용합니다. 이 예제에서는 Google Fonts에서 Noto Sans를 로드합니다:
import { useState, useEffect } from "react";import { DatePicker } from "react-date-range-picker-tailwind4";
function CompoundNotoSans() { const [value, setValue] = useState<Date | null>(null);
useEffect(() => { if (!document.getElementById("noto-sans-font")) { const link = document.createElement("link"); link.id = "noto-sans-font"; link.rel = "stylesheet"; link.href = "https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap"; document.head.appendChild(link); } }, []);
return ( <div style={{ fontFamily: '"Noto Sans", sans-serif' }}> <DatePicker value={value} onChange={setValue} inline /> </div> );}March 2026
Su
Mo
Tu
We
Th
Fr
Sa
💡 프로덕션 환경에서의 사용
실제 프로젝트에서는 런타임에 주입하는 대신 HTML <head>의 <link> 태그나 CSS 번들러를 통해 글꼴을 로드하세요. 여기의 useEffect 방식은 오직 데모 목적으로만 사용되었습니다.
웹 폰트 갤러리
타이포그래피가 피커의 외관을 얼마나 극적으로 변화시키는지 다양한 웹 폰트를 비교해 보세요. 아래의 모든 글꼴은 다국어 렌더링(라틴어, CJK, 한국어)을 지원합니다.
import { useState, useEffect } from "react";import { DatePicker } from "react-date-range-picker-tailwind4";
const WEB_FONTS = [ { name: "Noto Sans", family: '"Noto Sans", sans-serif' }, { name: "Noto Serif", family: '"Noto Serif", serif' }, { name: "IBM Plex Sans", family: '"IBM Plex Sans", sans-serif' }, { name: "Roboto Slab", family: '"Roboto Slab", serif' },];
const FONT_URL = "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&family=Noto+Serif:wght@400;500;600;700&family=Roboto+Slab:wght@400;500;600;700&display=swap";
function CompoundWebFonts() { const [value, setValue] = useState<Date | null>(null); const [active, setActive] = useState(0);
useEffect(() => { if (!document.getElementById("web-fonts-link")) { const link = document.createElement("link"); link.id = "web-fonts-link"; link.rel = "stylesheet"; link.href = FONT_URL; document.head.appendChild(link); } }, []);
return ( <div> <div style={{ display: "flex", gap: 6, marginBottom: 12, flexWrap: "wrap" }}> {WEB_FONTS.map((f, i) => ( <button key={f.name} onClick={() => setActive(i)} style={{ padding: "6px 14px", border: `1px solid ${active === i ? "#3b82f6" : "#d1d5db"}`, borderRadius: 6, background: active === i ? "#eff6ff" : "#fff", color: active === i ? "#3b82f6" : "#374151", cursor: "pointer", fontSize: 13, fontFamily: f.family, }} > {f.name} </button> ))} </div> <div style={{ fontFamily: WEB_FONTS[active].family }}> <DatePicker value={value} onChange={setValue} inline /> </div> </div> );}March 2026
Su
Mo
Tu
We
Th
Fr
Sa