Crates.io | tabler-icon-definer |
lib.rs | tabler-icon-definer |
version | 2.0.5 |
source | src |
created_at | 2025-02-10 21:57:31.925249+00 |
updated_at | 2025-03-30 12:40:49.245579+00 |
description | Macros for fast incremental loading tabler icons |
homepage | |
repository | https://github.com/TOwInOK/SSS-rs |
max_upload_size | |
id | 1550722 |
size | 62,329 |
A Rust procedural macro crate for embedding Tabler SVG icons into your binary at compile time.
Add this to your Cargo.toml
:
[dependencies]
tabler-icon-definer = "2"
use tabler_icon_definer::tabler_icon;
tabler_icon!(
brand_github[outline, filled],
user[outline]
);
// Generates:
// - Tabler::OUTLINE_BRAND_GITHUB
// - Tabler::FILLED_BRAND_GITHUB
// - Tabler::OUTLINE_USER
tabler_icon!(
#[name = "github"]
brand_github[outline, filled]
);
// Generates:
// - Tabler::OUTLINE_GITHUB
// - Tabler::FILLED_GITHUB
tabler_icon!(
#[derive(serde::Serialize)]
#[name = "github"]
brand_github[outline, filled]
);
let icon = Tabler::OUTLINE_GITHUB;
// Get SVG content
let svg = icon.as_str();
// Get icon name without style prefix
let name = icon.as_str_merget();
// Get full icon name with style prefix
let full_name = icon.to_string();
// Get all available icons
let all_icons = Tabler::all_icons();
leptos
feature
// Get leptos AnyView component
let component = Tabler::OUTLINE_GITHUB.to_leptos();
To find the correct icon names, visit Tabler Icons.
Icons are cached in target/icon_cache
for 30 days to avoid unnecessary downloads.
MIT
Contributions are welcome! Please feel free to submit a Pull Request.