diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6fd43687e..4e242a1bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
- A file input with `multiple` now keeps every selected file, instead of only the last one. The new [`sqlpage.persist_uploaded_files`](https://sql-page.com/functions.sql?function=persist_uploaded_files) function saves them all and returns a JSON array with the `path`, original `name`, `mime_type` and `size` of each file.
- Set `wrap` on a `big_number` component to show long titles and descriptions across multiple lines.
+- Inline icons now align with their labels in components such as tabs and steps.
## v0.48.0 (2026-11-12)
diff --git a/examples/official-site/custom_components.sql b/examples/official-site/custom_components.sql
index ff2902a79..24e12e651 100644
--- a/examples/official-site/custom_components.sql
+++ b/examples/official-site/custom_components.sql
@@ -131,7 +131,7 @@ and SQLPage adds a few more:
- `array_contains`: returns true if a list contains a value
- `static_path`: returns the path to one of the static files bundled with SQLPage. Accepts arguments like `sqlpage.js`, `sqlpage.css`, `apexcharts.js`, etc.
- `app_config`: returns the value of a configuration parameter from sqlpage''s configuration file, such as `max_uploaded_file_size`, `site_prefix`, etc.
-- `icon_img`: generate an svg icon from a *tabler* icon name
+- `icon_img`: render a Tabler SVG icon aligned with adjacent text. An optional second argument sets its size in pixels (default 24).
- `markdown`: renders markdown text. Accepts an optional 2nd argument `''allow_unsafe''` that will render embedded html blocks: use only on trusted content. See the [Commonmark spec](https://spec.commonmark.org/0.31.2/#html-blocks) for more info.
- `each_row`: iterates over the rows of a query result
- `typeof`: returns the type of a value (`string`, `number`, `boolean`, `object`, `array`, `null`)
diff --git a/frontend/src/icons.css b/frontend/src/icons.css
new file mode 100644
index 000000000..ad32b3a21
--- /dev/null
+++ b/frontend/src/icons.css
@@ -0,0 +1,4 @@
+.sqlpage-icon {
+ /* An inline SVG's baseline is its bottom edge. Center it on capital letters. */
+ vertical-align: calc((1cap - attr(height px)) / 2);
+}
diff --git a/scripts/build-frontend.mjs b/scripts/build-frontend.mjs
index c33c2296d..deffeb655 100644
--- a/scripts/build-frontend.mjs
+++ b/scripts/build-frontend.mjs
@@ -11,6 +11,7 @@ const STYLESHEET = [
"node_modules/@tabler/core/dist/css/tabler.min.css",
"node_modules/tom-select/dist/css/tom-select.bootstrap5.css",
"node_modules/@tabler/core/dist/css/tabler-vendors.min.css",
+ "frontend/src/icons.css",
"frontend/src/sqlpage.css",
];
diff --git a/src/template_helpers.rs b/src/template_helpers.rs
index 0f97126d3..d50988c30 100644
--- a/src/template_helpers.rs
+++ b/src/template_helpers.rs
@@ -239,7 +239,7 @@ impl HelperDef for IconImgHelper {
write!(
writer,
- r#""#
+ r#""#
)?;
Ok(())
}
diff --git a/tests/end-to-end/fixtures/steps/index.sql b/tests/end-to-end/fixtures/steps/index.sql
new file mode 100644
index 000000000..32e3a1cdd
--- /dev/null
+++ b/tests/end-to-end/fixtures/steps/index.sql
@@ -0,0 +1,2 @@
+SELECT 'steps' AS component;
+SELECT 'Review' AS title, 'eye' AS icon, '#review' AS link;
diff --git a/tests/end-to-end/fixtures/steps/test.ts b/tests/end-to-end/fixtures/steps/test.ts
new file mode 100644
index 000000000..4bcbea2ac
--- /dev/null
+++ b/tests/end-to-end/fixtures/steps/test.ts
@@ -0,0 +1,21 @@
+import { expect, test } from "../../fixture.ts";
+
+test("the step icon aligns with the capital letters of its title", async ({
+ page,
+}) => {
+ const icon = page.getByRole("link", { name: "Review" }).locator("svg");
+ const offset = await icon.evaluate((svg) => {
+ // An empty inline-block sits on the text baseline. Its top is one cap height above it.
+ const capital = document.createElement("span");
+ capital.style.cssText = "display: inline-block; height: 1cap";
+ svg.after(capital);
+ const centerY = (element: Element) => {
+ const { top, height } = element.getBoundingClientRect();
+ return top + height / 2;
+ };
+ const delta = centerY(svg) - centerY(capital);
+ capital.remove();
+ return delta;
+ });
+ expect(Math.abs(offset)).toBeLessThanOrEqual(1);
+});