tauri-plugin-system-symbols
v0.3.0
Published
System symbol SVG paths for Tauri apps.
Readme
tauri-plugin-system-symbols
Resolve platform system symbols into SVG path data from a Tauri app.
This plugin is designed for apps that want native-looking symbols without bundling icon fonts or SVG assets.
Packages
- Rust crate:
tauri-plugin-system-symbols - JavaScript package:
tauri-plugin-system-symbols - React package:
tauri-plugin-system-symbols-react
Status
- Windows:
Segoe Fluent Iconsis resolved first, withSegoe MDL2 Assetsas the fallback. - macOS: copied
SF Symbolscharacters are resolved through CoreText and converted fromCGPathto SVG path data. - Other platforms: unsupported.
Calling the resolver on an unsupported platform rejects with a Rust backend error.
On macOS, pass the character produced by SF Symbols' Copy Symbol command,
not the symbol name. For example, is the copied character for
square.and.arrow.down.badge.clock.
Install
Install the Rust plugin in your Tauri app:
# src-tauri/Cargo.toml
[dependencies]
tauri-plugin-system-symbols = "0.3"Install the JavaScript package:
pnpm add tauri-plugin-system-symbolsRegister the plugin:
tauri::Builder::default()
.plugin(tauri_plugin_system_symbols::init());Add the default permission to your capability file:
{
"permissions": ["system-symbols:default"]
}JavaScript API
import { getCachedSymbol, getSymbol } from 'tauri-plugin-system-symbols'
const close = getCachedSymbol('\uE8BB', 10) ?? await getSymbol('\uE8BB', 10)
const history = await getSymbol('', 16) // square.and.arrow.down.badge.clockTauri IPC is asynchronous, so first-time symbol resolution returns a Promise<Path[]>.
Resolved symbols are cached by symbol and size.
Rust API
Other Rust crates can call the native resolvers directly without registering this crate as a Tauri plugin:
let close = tauri_plugin_system_symbols::get_symbol("\u{E8BB}", 10.0)?;
let history = tauri_plugin_system_symbols::get_symbol("", 16.0)?; // square.and.arrow.down.badge.clockThis is the recommended integration path when another Tauri plugin only needs the generated SVG path data internally. Symbols are resolved according to the current operating system.
Types
interface Path {
d: string
fillRule?: 'nonzero' | 'evenodd'
opacity?: number
}React
React components are provided by
tauri-plugin-system-symbols-react.
pnpm add tauri-plugin-system-symbols-react @tauri-apps/plugin-osDevelopment
pnpm install
pnpm run check
pnpm run build
cargo check
cargo testPublishing
Publishing is handled by .github/workflows/publish.yml.
Create a tag to publish both packages:
git tag v0.1.0
git push origin v0.1.0The workflow sets package.json and Cargo.toml versions from the tag, then publishes:
- npm with
npm publish --provenance --access public - crates.io with
rust-lang/crates-io-auth-action
Before the first trusted publish, configure trusted publishing in both registries:
- npm: trust
insd47/tauri-plugin-system-symbolsand workflow.github/workflows/publish.yml - crates.io: trust
insd47/tauri-plugin-system-symbolsand workflow.github/workflows/publish.yml
License
MIT
