SVG → React/JSX Component Converter
Convert SVG sang React/JSX component. Tự động đổi attribute kebab-case → camelCase, hỗ trợ TypeScript, currentColor, size/color props.
Convert SVG (raw XML hoặc Figma export) sang React/JSX component. Đổi attribute kebab-case → camelCase, escape <style>, optional TypeScript types.
Khi nào cần convert SVG → JSX?
- Từ Figma export: designer xuất SVG → bạn paste sang React component để dùng.
- Icon library tự build: thay vì dùng react-icons, build set icon riêng từ Heroicons / Tabler.
- Logo + illustrations: brand SVG → component có size/color props.
- Animation: convert sang JSX để bind state vào attribute.
Khác biệt SVG vs JSX
- kebab-case → camelCase:
stroke-width→strokeWidth,fill-rule→fillRule. - class → className (JSX rule cho HTML/SVG element).
- style: từ string CSS sang object:
style="color:red"→style={{color: 'red'}}. - <style> tag: phải wrap CSS trong backtick để JSX không parse:
<style>{`...`}</style>. - viewBox: GIỮ NGUYÊN camelCase (không phải
view-box).
Tip props pattern
- size prop: width/height nhận props để dễ resize. Default 24.
- currentColor: dùng
fill="currentColor"để icon kế thừacolorcủa parent — đổi màu bằngclassName="text-red-500". - ...props spread: cho phép pass
onClick,aria-label, etc. - TypeScript: extend
React.SVGProps<SVGSVGElement>để có full type safety.
Phù hợp với ai
Frontend dev, UI/UX designer, ai cần prototype visual nhanh hoặc sinh CSS chuẩn copy-paste cho dự án Tailwind/React/Vue.
Câu hỏi thường gặp
CSS sinh ra có dùng được với Tailwind không?
Có. Output là CSS chuẩn vanilla, paste vào file .css bất kỳ. Nếu dự án dùng Tailwind, có thể đặt vào layer @utilities hoặc theme override.
Có hỗ trợ trình duyệt cũ không?
Output dùng cú pháp CSS modern (custom properties, grid, gap). Hoạt động tốt trên Chrome/Firefox/Safari 2020+. IE11 KHÔNG được hỗ trợ.
Công cụ liên quan
Xem tất cả công cụ →Color Picker
Pick HEX/RGB/HSL, slider RGB, 12 màu mẫu, gợi ý tên Tailwind gần nhất.
MỚITailwind ↔ CSS Converter
Convert giữa Tailwind utility classes và CSS thuần. ~200 utility (spacing, color, flex, grid…). Hỗ trợ migrate dự án.
MỚICSS Animation Builder
Visual builder cho CSS animation. 10 preset (fadeIn, bounce, pulse, spin, shake…). Tinh chỉnh duration, easing, iteration.
MỚICSS Filter Builder
Visual builder cho CSS filter — blur, brightness, sepia, hue-rotate, drop-shadow. 8 preset (Vintage, Polaroid, Noir…).