htsx

Icons

Easy way to use SVG icons with no dependencies.

1. Find SVG icons

Lucide is recommended. https://lucide.dev/icons/

2. Copy SVG

Press Copy SVG button on Lucide.

3. Paste it and export it

Paste SVG in ui/icons.tsx and export it as Hono JSX component.

ui/icons.tsx
export const Check = () => (
  <svg
    xmlns="http://www.w3.org/2000/svg"
    width="24"
    height="24"
    viewBox="0 0 24 24"
    fill="none"
    stroke="currentColor"
    stroke-width="2"
    stroke-linecap="round"
    stroke-linejoin="round"
    class="lucide lucide-check-icon lucide-check"
  >
    <path d="M20 6 9 17l-5-5" />
  </svg>
);

4. Use it

Import and use it as JSX component.

todo.tsx
import { Check } from "./icons";
 
<Check />;

5. Customize

You can change the size globally.

style.css
@layer components {
  svg[class*="lucide"] {
    @apply size-4;
  }
}

You can change the size per use.

hoge.tsx
<span class="[&>svg]:size-3">
  <Copy />
</span>