Skip to content

Icon

pz.icon(name) draws one of the 1,500+ Lucide icons; color defaults to the surrounding text color. pz.svg(source) draws any SVG from a path or bytes, tinted with color if you want.

pz.icon · Category: Content · Full reference →

IconIcon
  • Inside buttons, list rows and headers. Run pyzed icons to search the names.
import pyzed as pz
pz.row([
pz.icon("sparkles", size=28, color="#e5c07b"),
pz.icon("git-branch", size=28, color="#a1c181"),
pz.icon("folder-open", size=28, color="#74ade8"),
pz.icon("bug", size=28, color="#d07277"),
pz.icon("terminal", size=28, color="#c678dd"),
pz.svg("logo.svg", width=40, height=40),
], spacing=20, align="center")
Icon: size=12Icon: size=12
size=12
Code
pz.icon("sparkles", size=12)
Icon: size=16Icon: size=16
size=16
Code
pz.icon("sparkles", size=16)
Icon: size=24Icon: size=24
size=24
Code
pz.icon("sparkles", size=24)
Icon: size=40Icon: size=40
size=40
Code
pz.icon("sparkles", size=40)
Icon: color="#a1c181"Icon: color="#a1c181"
color="#a1c181"
Code
pz.icon("git-branch", size=24, color="#a1c181")
Icon: color="#d07277"Icon: color="#d07277"
color="#d07277"
Code
pz.icon("bug", size=24, color="#d07277")
Icon: color="#74ade8"Icon: color="#74ade8"
color="#74ade8"
Code
pz.icon("folder-open", size=24, color="#74ade8")

color paints every visible pixel of the SVG in one color and keeps the transparent ones, like an icon tint. An SVG with a filled background, such as logo.svg, becomes a plain tile.

Icon: pz.svg("logo.svg")Icon: pz.svg("logo.svg")
pz.svg("logo.svg")
Code
pz.svg("logo.svg", width=48, height=48)
Icon: color="#e5c07b"Icon: color="#e5c07b"
color="#e5c07b"
Code
shapes = ('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">'
'<circle cx="7" cy="7" r="5"/><rect x="12" y="12" width="10" height="10" rx="2"/></svg>')
pz.svg(shapes, width=48, height=48, color="#e5c07b")

Icon has no events of its own: it shows what you give it. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.

icon(name, *, size=16, color=None)

A Lucide icon. color defaults to the surrounding text color.

Property Default Description
name required Icon name (pyzed icons lists them).
size 16 Size in pixels.
color None Color.

Full reference →

svg(
source,
*,
width=None,
height=None,
color=None,
content_fit=None,
opacity=1.0,
rotation=0.0,
)

An SVG image.

Property Default Description
source required Path to an .svg, the SVG code as a string (starting with <) or bytes.
width None Width: pixels, "fill", "shrink" or "fill:N" (proportion).
height None Height: pixels, "fill", "shrink" or "fill:N" (proportion).
color None If given, tints the whole SVG with that color (useful for monochrome icons).
content_fit None "contain", "cover", "fill", "none" or "scale-down".
opacity 1.0 Opacity from 0 to 1.
rotation 0.0 Rotation in degrees.

Full reference →