wok-ui-icon

Define and render scalable SVG icons in wok-ui with SvgIcon and RemoteSvgIcon.

Updated Sep 14, 2023
One-click install
npx skills add https://github.com/PeakTai/wok-ui --skill wok-ui-icon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wok-ui-icon
Source: https://github.com/PeakTai/wok-ui/tree/main/skills/wok-ui-icon
Command: npx skills add https://github.com/PeakTai/wok-ui --skill wok-ui-icon

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing SVG icons in a UI library can be verbose and inconsistent. This skill introduces a unified approach to using wok-ui's SvgIcon for local icons and RemoteSvgIcon for on-demand remote icons, ensuring consistent sizing and coloring across the app.

Core Features & Use Cases

  • Local icons with SvgIcon: define custom icons by extending SvgIcon and embedding SVG code.
  • Remote icons with RemoteSvgIcon: load icons on demand and cache in memory for performance.
  • API consistency: setSize, setColor, and onClick for uniform interaction and theming.

Quick Start

Create a custom Icon by extending SvgIcon or RemoteSvgIcon and mount it in your UI.

Frequently Asked Questions about wok-ui-icon

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render SVG icons in TypeScript with consistent sizing and coloring?

You can render SVG icons by extending the SvgIcon component to embed local SVG code, which ensures consistent sizing and coloring. This approach provides type-safe usage and allows interaction via onClick handlers.

What is the best way to load SVG icons on demand in a UI library?

Loading SVG icons on demand is best handled using RemoteSvgIcon, which fetches remote icons and caches them in memory for performance. This enables on-demand loading and theming across diverse components.

Can I customize the size and color of SVG icons programmatically?

Yes, you can customize SVG icons programmatically using the setSize and setColor APIs. These methods provide a unified approach to theming, ensuring uniform appearance and interaction across your application.

How do I attach click handlers to SVG icons in a TypeScript frontend?

You can attach click handlers to SVG icons by utilizing the onClick property provided by the SvgIcon and RemoteSvgIcon components. This enables type-safe interactive behavior directly within your icon definitions.

When should I use local SvgIcon versus RemoteSvgIcon for UI rendering?

Use local SvgIcon when embedding custom SVG code to ensure maximum performance, and use RemoteSvgIcon when you need on-demand loading and memory caching. Both provide a consistent API for sizing and coloring.