@hozo/svg•<svg> · react-native-svg

One Svg namespace, both platforms

Write <Svg>, Svg.Path, Svg.Filter and the rest once. On the Web the compiler lowers them to the browser's own SVG elements, with nothing in between; on iOS and Android they become react-native-svg 15.9 or newer.

Filter studio

A drop shadow and a blur, defined once in Svg.Defs and referenced by id.

Svg.FeDropShadow

0
4
6
40%
floodColor

Svg.FeGaussianBlur (the centre motif's glow)

3

The source for what is drawn above. To see what the compiler makes of it on the Web, paste it into the REPL.

SVG filter source
import { Svg } from '@hozo/svg'<Svg viewBox="0 0 200 200" accessibilityLabel="Asanoha, the hemp-leaf pattern">  <Svg.Defs>    <Svg.Filter id="shadow" x="-40%" y="-40%" width="180%" height="180%">      <Svg.FeDropShadow        dx={0}        dy={4}        stdDeviation={6}        floodColor="#c8a882"        floodOpacity={0.4}      />    </Svg.Filter>  </Svg.Defs>  <Svg.G filter="url(#shadow)">{/* the asanoha */}</Svg.G></Svg>

Compiled, not hydrated

These three ship no JavaScript: Astro renders them at build time and the page holds plain <svg>. They are decoration beside their captions, so they are hidden from assistive technology.

Shapes

Svg.Polygon, Svg.Circle and Svg.Line

Drop shadow

Svg.Filter with Svg.FeDropShadow

Gradient and blur

Svg.LinearGradient with Svg.FeGaussianBlur

What the namespace gives you

A name, or none

With accessibilityLabel, an Svg is an image with that name: role="img" on the Web, accessibilityRole="image" on Native. If it holds text, a pressable shape, or content the compiler cannot see into, on the Web it is a named group instead, because an image hides its children. Without a label it gets no role; mark pure decoration aria-hidden, as the specimens above are.

Filters both platforms draw

Svg.Filter with ColorMatrix, GaussianBlur, Offset, Flood, Composite, Blend, Merge and DropShadow: the set react-native-svg implements. On Android, Hozo corrects blur radii for screen density and viewBox scaling; it is not pixel parity, and the README lists what still differs.

Links inside a drawing

Svg.Link is an SVG anchor on the Web and a router-aware pressable group on Native, through the same navigation provider as @hozo/navigation.

Icons from your own set

Icon draws Lucide-shaped icon data. No set is bundled, so a Native bundle carries only the icons you import; unnamed icons are decoration and hidden, named ones are images.

Filter coverage, measured

From the conformance snapshot (pnpm --filter @hozo/tailwind-conformance report). These count API, compiler and import routing — not pixel equivalence or rendering on a device.

Web10 / 26

Filter-family members exposed by Hozo, out of everything react-native-svg exports. The rest are not exposed yet.

Native10 / 10

Of the members upstream actually implements. 16 more are warning-only stubs upstream and are not counted.

Writing one

Effects live in Svg.Defs and are referenced by id, exactly as in SVG itself.

SVG authoring: Verified.tsx
import { Svg } from '@hozo/svg'export function Verified() {  return (    <Svg viewBox="0 0 80 80" accessibilityLabel="Verified">      <Svg.Defs>        <Svg.Filter id="shadow">          <Svg.FeDropShadow dy={3} stdDeviation={2} floodOpacity={0.4} />        </Svg.Filter>      </Svg.Defs>      <Svg.Circle cx={40} cy={40} r={24} fill="#c8a882" filter="url(#shadow)" />      <Svg.Path d="M32 40 L38 46 L50 34" stroke="#100f0e" strokeWidth={3} />    </Svg>  )}