Skip to content

feat(theme): add an icon-only style and icon sizes to the button recipe - #408

Merged
alexgrozav merged 1 commit into
mainfrom
button-icon-only-uxf-912
Nov 20, 2026
Merged

alexgrozav merged 1 commit into
mainfrom
button-icon-only-uxf-912

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

Description

The button recipe now sizes icons and styles icon-only buttons, so Inkline's Button can drop its three local icon-only rules once it takes the next @styleframe/theme release. It adds four rules:

  • Icon size. Each size sets --button--icon--size (0.875, 1, 1, 1.25 and 1.25 spacing steps from xs to xl, as in the Open Components reference). The value is a root theme variable, and each button sets its own size's value at zero specificity with :where(), so any single class on the button overrides it.
  • Icon slots. The data-slot="leading" and data-slot="trailing" children are centred boxes of that size, and the icon inside fills them.
  • Icon only. A button with data-icon-only and data-size is square: its inline padding takes the size's block padding, and the leading slot is a square box as tall as the line, or as the icon when a larger icon size is set.
  • Hidden label. The data-slot="label" child of an icon-only button is hidden from view with a 1px clipped box, so it stays the accessible name.

The selectors live in the recipe's setup, since no recipe key can reach the slot children. They use the attributes Inkline already renders (data-size, data-icon-only, data-slot), so Inkline changes no markup. The size variants now read their block padding from one blockPadding table that the icon-only rules share, and the compiled CSS of a labelled button is unchanged: a diff of the compiled recipe against main shows only added lines.

Storybook's Button.vue gets leading and trailing slots, an iconOnly prop and data-size, and two new stories, "With Icons" and "Icon Only", show every size. The docs page gets an "Icons" section with the markup, an "Icon Size" column, an accessibility note and a customisation note.

Related issue

None in this repository.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope

Notes / screenshots

  • The docs page embeds the new stories from the deployed Storybook, so they show there once Storybook deploys.
  • A consumer who overrides a size's paddingTop through the recipe options also needs to override the icon-only padding-inline, since setup can't read the options. The docs say so.
  • Measured in the built Storybook in Chrome, at 1440px and 390px wide: every icon-only button is square, icons are 14, 16, 16, 20 and 20px, a 2rem override gives 32px icons in still-square buttons, and getByRole("button", { name }) finds each one.

Each button size sets --button--icon--size for the icons in its leading
and trailing slots. A button with data-icon-only and data-size is square,
with its label hidden from view but kept as the accessible name. The
selectors match the markup Inkline's Button already renders.
@alexgrozav
alexgrozav marked this pull request as ready for review November 20, 2026 21:19
@alexgrozav
alexgrozav merged commit 9e14ea4 into main Nov 20, 2026
12 checks passed
@alexgrozav
alexgrozav deleted the button-icon-only-uxf-912 branch November 20, 2026 21:31
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant